aspose file tools*
The moose likes Object Relational Mapping and the fly likes how to update OneToMany Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "how to update OneToMany" Watch "how to update OneToMany" New topic
Author

how to update OneToMany

Thomas Willingham
Greenhorn

Joined: Jun 24, 2010
Posts: 8
I am using hibernate, jpa 2.0, I can persist a OneToMany relationship ok but can't update it (by adding a new element), I have tried many methods and get 1 of two errors each time, "can't insert null into user_id" or "UserRoles is transient persist first". There seems to be no way to do this, are my annotations wrong. It seems it wants me to persist user roles first but if I try it tells me user_id can not be null, but I can't set user id only user object???




Thomas Willingham
Greenhorn

Joined: Jun 24, 2010
Posts: 8
got it working with this

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how to update OneToMany