Is it possible that saveOrUpdate will not work for the children of this object, and I have to use update(obj, id) instead? Damn, I thought hibernate was easy and now it's kicking my ass! It's probably something super simple and I'm just not seeing it. To re-iterate (I know you guys hate me by now), here's a brief overview of my code.
** all classes extend from BaseObject with has equals(), hashCode() and toString() methods. Parent.java --- private Long id; private List children; +appropriate getters/setters Parent.hbm.xml --- <bag role="children" table="CHILDREN" cascade="all"> <key column="parent_id" length="22"/> <one-to-many class="eg.Child"/> </bag> Child.java --- private ChildId id; +appropriate getter/setter ChildId.java --- private Long parentId; private Long recordNum; + appropriate getter/setters Child.hbm.xml --- <composite-id name="id" class="eg.ChildId" unsaved-value="none"> <key-property column="parent_id" length="22" name="parentId" type="long"/> <key-property column="record_num" length="22" name="recordNum" type="long"/> </composite-id> I am able to retrieve children just fine, but when I try to save the parent, hibernate tries to do an insert and I get a unique constraint violation. I'm calling the following method to save everything: public Parent saveParent(Parent p) throws DAOException { storeObject(p); return (Parent) retrieveObject(eg.Parent.class, p.getId()); } I got the storeObject method from one of the examples floating around, so it could definitely be my problem: protected void storeObject(Object obj) throws DAOException { Session ses = null; try { ses = HibernateSession.currentSession(); ses.saveOrUpdate(obj); ses.flush(); ses.connection().commit(); } catch (Exception e) { try { ses.connection().rollback(); } catch (Exception ex) { e.printStackTrace(); } ; throw new DAOException(e); } finally { try { HibernateSession.closeSession(); } catch (Exception ex) { ex.printStackTrace(); } ; } } Thanks, Matt ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel