Hi,
I have a ternary mapping based on a <map/> (see below). When I save the User object, I get the following error,
Code:
net.sf.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: Group
If I manually save the added Groups before adding them to the map, then saving the User works fine. The cascading save of the Roles seems to work fine.
Any suggestions?
Thanks,
-Mitch
Here is the mapping,
Code:
<class name="User" table="SEC_USER">
...
<map name="groupRoles" cascade="all" table="SEC_USER_GROUP_ROLE">
<key column="USER_ID"/>
<index-many-to-many column="GROUP_ID" class="Group"/>
<many-to-many column="ROLE_ID" class="Role"/>
</map>
</class>
which maps to tables,
Code:
SEC_USER--oSEC_USER_GROUP_ROLEo--SEC_GROUP
o
|
SEC_ROLE
[/code]