[Lift] Re: I am not able to save a many-to-many relationship from an API

2009-10-26 Thread GA
I have made a test that worked. I have modified my code like this: newUser.save newUser.devices += newDevice newUser.save The newDevice was already saved. It looks like both parents

[Lift] Re: I am not able to save a many-to-many relationship from an API

2009-10-26 Thread Jim Barrows
On Mon, Oct 26, 2009 at 11:43 AM, GA my_li...@me.com wrote: I have made a test that worked. I have modified my code like this: newUser.save newUser.devices += newDevice newUser.save

[Lift] Re: I am not able to save a many-to-many relationship from an API

2009-10-26 Thread GA
Thanks for the answer. I understand now. But I have a follow up question. This is the code for my relationship table, which I've done following some examples and previous discussions about this subject: class UserDevice extends LongKeyedMapper[UserDevice] with IdPK { def getSingleton =

[Lift] Re: I am not able to save a many-to-many relationship from an API

2009-10-26 Thread Naftoli Gugenheim
It would be feasible to refactor ManyToMany to remove this restriction. OneToMany does not require either side to be saved first. Can you describe a use case where it would be desirable? - Jim Barrowsjim.barr...@gmail.com wrote: On Mon, Oct 26, 2009 at 11:43

[Lift] Re: I am not able to save a many-to-many relationship from an API

2009-10-26 Thread Jim Barrows
On Mon, Oct 26, 2009 at 12:05 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: It would be feasible to refactor ManyToMany to remove this restriction. OneToMany does not require either side to be saved first. Can you describe a use case where it would be desirable? I don't think there is.

[Lift] Re: I am not able to save a many-to-many relationship from an API

2009-10-26 Thread Naftoli Gugenheim
What do you mean by that? Every primary key is unique. - Jim Barrowsjim.barr...@gmail.com wrote: On Mon, Oct 26, 2009 at 12:05 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: It would be feasible to refactor ManyToMany to remove this restriction.

[Lift] Re: I am not able to save a many-to-many relationship from an API

2009-10-26 Thread Jim Barrows
On Mon, Oct 26, 2009 at 2:36 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: What do you mean by that? Every primary key is unique. The pivot table is typically only 2 columns, which are the PK's for each side of the MTM. ---- ---

[Lift] Re: I am not able to save a many-to-many relationship from an API

2009-10-26 Thread Naftoli Gugenheim
Do you mean foreign keys? Why does that preclude linking them before they're saved? OneToMany also uses a foregn key / primary key relationship, and you can use LongMapperMapper. - Jim Barrowsjim.barr...@gmail.com wrote: On Mon, Oct 26, 2009 at 2:36 PM,