Well, it sounds like you did something like "task =
dataContext.newObject(Task.class)" and then "employee.setTask(task)",
which would definitely cause an insert of a new task (and the same for
department). If you have an existing task, it should only define the
relationship between the employee and the task (inserting the
employee, since you are creating a new one).
On Thu, Apr 17, 2008 at 12:10 PM, Mauro Carniel <mauro.carnie..inet.it> wrote:
> I'll try to provide the app but... not for today.
> Anyway thanks for now.
>
> Cheers,
> Mauro
>
>
> ----- Original Message ----- From: "Michael Gentry" <blacknex..mail.com>
> To: <use..ayenne.apache.org>
> Sent: Thursday, April 17, 2008 6:04 PM
> Subject: Re: Fw: help on saving obj using relations
>
>
>
>
>
> > Could you include a snippet of your code?
> >
> >
> > On Thu, Apr 17, 2008 at 12:00 PM, Mauro Carniel <mauro.carnie..inet.it>
> wrote:
> >
> > > I never said that "demo36" is an example of a program that has the issue
> > > I've described in past news!
> > > That sample correctly operates, because it does not use relationships
> > > defined as you described!
> > >
> > > When I tried to define relationships using Cayenne modeler the problem
> on
> > > inserting arised. I followed the same steps you reported here and it
> does
> > > not work: this is the problem!
> > >
> > >
> > >
> > > ----- Original Message ----- From: "Michael Gentry"
> <blacknex..mail.com>
> > > To: <use..ayenne.apache.org>
> > > Sent: Thursday, April 17, 2008 5:46 PM
> > > Subject: Re: help on saving obj using relations
> > >
> > >
> > >
> > >
> > >
> > > > I looked at:
> > > >
> > > >
> > >
> http://oswing.svn.sourceforge.net/viewvc/oswing/trunk/srcdemo/demo36/auto/_EmpVO.java?revision=214&view=markup
> > > >
> > > > And I don't believe you have modeled your relationships correctly.
> > > > You manually created a get/setDept() and get/setTask() in the
> > > > subclass:
> > > >
> > > >
> > >
> http://oswing.svn.sourceforge.net/viewvc/oswing/trunk/srcdemo/demo36/EmpVO.java?revision=214&view=markup
> > > >
> > > > However, those should be generated by Cayenne in the parent
> > > > (_EmpVO.java) class. At least if you have your relationships modeled
> > > > correctly. Go back into the modeler and look under the Relationship
> > > > tab for both your DbEntity and your ObjEntity and make sure they are
> > > > defined in each place. You may need to synchronize your ObjEntity
> > > > with your DbEntity (click the sync button). After you get your
> > > > relationships defined, regenerate your superclasses.
> > > >
> > > > /dev/mrg
> > > >
> > > >
> > > >
> > > > On Thu, Apr 17, 2008 at 11:03 AM, Gustav Weber >
> <gustav_weber7..ahoo.com>
> > > wrote:
> > > >
> > > > > I guess Mauro forgot to mention an important aspect:
> > > > >
> > > > > The situation appeared while integrating Cayenne with
> > > > > OpenSwing:
> > > > > http://oswing.sourceforge.net/
> > > > >
> > > > > and the problem he describes can be seen/reproduced
> > > > > from the code example in "srcdemo/demo36" from the
> > > > > project's Sourceforge SVN repository:
> > > > > http://sourceforge.net/projects/oswing/
> > > > >
> > > > > regards,
> > > > > Gustav.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > >
> ____________________________________________________________________________________
> > > > > Be a better friend, newshound, and
> > > > > know-it-all with Yahoo! Mobile. Try it now.
> > > http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
>
>
>
This archive was generated by hypermail 2.0.0 : Thu Apr 17 2008 - 12:15:52 EDT