Please ignore the above post. Its copy/paste error :)- Here is the full post We use JSF, Spring, Hibernate We are having problems updating associated objects Let say if Parent object ( in my case DeviceType) is associated with 3 records of Child object ( in my case Role) .
During update, if i add or delete a Role from User Interface, i have observed the default behaviour of Hibernate is to "delete the exsisting records from association table and then insert the (new) updated records " I figured out whats going wrong & the fix is to implement "equals" & "hashcode" methods to compare the primary keys of the two objects. i.e. equals method will check - if new objects are added to the collection (i.e. Lsit), - if they are old do nothing, - if there are any new objects in the collection (i.e. Lsit) not present in the pojo then drop them. - if any new objects are added to the collection (i.e. Lsit), - if they are old do nothing, - if there are any new objects in the collection (i.e. Lsit) which are not present in the pojo then drop them. As we use ormtool to generate Hibernate Pojos & Dao objects, we are reluctant to modify them and have similar implementation in business Layer i.e. Spring Its years that i looked into CoreJava any pointers/suggestions with snippet code will be highly appreciated bansi wrote: > > - if any new objects are added to the collection (i.e. Lsit), > - if they are old do nothing, > - if there are any new objects in the collection (i.e. Lsit) which are not > present in the pojo then drop them. > > As we use ormtool to generate Hibernate Pojos & Dao objects, we are > reluctant to modify them and have similar implementation in business Layer > i.e. Spring > Its years that i looked into CoreJava any pointers/suggestions with > snippet code will be highly appreciated > > > > Regards > > Bansi > -- View this message in context: http://www.nabble.com/Simple-Java-Question-tf3997491.html#a11353095 Sent from the MyFaces - Users mailing list archive at Nabble.com.