Hey Matt, Thanks for the response. These are exactly the steps that I took. The problem that I am running into is that when I generate my classes the Product Class contains a List of Keyword.class not java.lang.String.
I am guessing that since Cayenne 2.0.4 requires persistent classes to extend a base class that persisting simple classes/relationships like collections java.lang.String is not as simple. The big question is whether it is even possible. I have read a little on Cayenne 3.0 and it sounds like it is more inline, but the fact that it is not stable is a little disconcerting to me since I am writing something that will be in production before it is even gets into a release candidate stage. Any other ideas? ----- Original Message ---- From: Matt Kerr <m...@centralparksoftware.com> To: user@cayenne.apache.org; Bret Gregory <bmg...@yahoo.com> Sent: Tuesday, August 25, 2009 10:55:15 PM Subject: Re: Newbie Question: Mapping a Collection of Strings Hey Bret - Unless I'm missing - yes, this is right on the mark for cayenne. If you have an existing database, the easiest is to create a new model and use Tools -> Re-engineer Databae Schema, ie http://cayenne.apache.org/doc/reverse-engineer-database.html Note- I find there a few quirks in the Modeler, so pay attention to the fine print like this, "... you need to select either a DataDomain or one of its children on the project tree." If you're starting from scratch - hmm, I'd thought there'd be more info here, but I'm not seeing it :-? http://cayenne.apache.org/doc/modeler-guide.html You'd need to do something *vaguely* like .. 1/ create a Database Entity for each of your tables: Product and Keyword. This includes defining PK. 2/ then still in the Database Entity - add the Relationship from Product -> Keyword. You have to open the Inspector (I) to define the columns which define the join. Set the name of reverse relationship -which will use the FK you mention. 3/ when that's all set, I'd hit the "C+" (Create Object Entity) to define your classes. 4/ Tools -> Generate Classes Hope this helps for now. -mk On Tue, Aug 25, 2009 at 10:08 PM, Bret Gregory<bmg...@yahoo.com> wrote: > I have a DB that looks something like this: > > Product > -ProductId > -Description > > Keyword > -ProductId > -Keyword > > Where Product -> Keyword is 1:N and Keyword has a FK rel back to Product. > > I would like the object model to look something like this: > > Product > -(String) _description > -(List<String>) _keywords > > Is it possible to map collections of simple objects and have them persisted > by Cayenne? Seems like this would be a pretty common request, but > I am not seeing a way to do this in the modeler. > > > >