Hi Pradeepbill,
1) It looks like you're trying to implement a bidirectional many-to-many association. Therefore, you need to make sure that you:
(a) map one end of the association with 'inverse="true"';
(b) make sure to add() to the the Collections on
both ends of the bidirectional association, not just one end (i.e., just like you would do in regular Java if there were no persistence layer); and
2) Looking at this Java code:
Code:
ContentObject contentObj = (ContentObject)getHibernateTemplate().load(ContentObject.class, contentObjectOid);
BOMDefn bd = (BOMDefn)getHibernateTemplate().load(BOMDefn.class, new Long("0"));
contentObj.getBoms().add(bd);
getHibernateTemplate().save(contentObj);
What is the call to save() supposed to do there? save() is what you call on a transient object to make it persistent. contentObj in this case is
already persisitent — you got it from load().
You might think from the names that save() is the opposite of load(), but it's not. delete() is the opposite of save().
cheers,
—ml—