| 
					
						 Hello,
 
 I am trying to maintain the following model described below.  I am going to describe it in high level terms as I would like an example of how to map it.  I have looked in the hibernate forum and been using the Hibernate In Action book, however I'm still confused.
 
 Model:
 
 I have a User object which holds a collection of codes.  Codes may be added and removed from the user's code collection as necessary.
 
 Each code object holds a collection of users.  Users may be added and removed from the code as necessary.
 
 Each collection as mapped with a set, using a many to many association.  What I'm finding is that when I modify the collection in one object, the other side of the association is not updated.  I.e.  when I add a code to a particular user, that user is not then visible in the code's collection.
 
 Mappings:
 
 user object's code collection:
 
 <set name="adminCodes" table="ADMIN_CODE_REL" inverse="false"   lazy="false" sort="natural">				
 <cache usage="read-write" region="domain.entity.USER_REGION"/>
 				<key column="ADMINISTRATOR_ID"/>
 				<many-to-many column="CODE_ID" class="domain.entity.attribute.CustomCode" where="MARK_FOR_DELETE=0"  />
 </set>
 
 code object's user collection:
 
 		<set name="administrators" table="ADMIN_CODE_REL" inverse="false" lazy="false" sort="natural"  batch-size="50"  >
 		<cache usage="read-write" region="domain.entity.USER_REGION"/>
 			<key column="CODE_ID"/>
 			<many-to-many column="ADMINISTRATOR_ID" class="domain.entity.Administrator" where="MARK_FOR_DELETE=0 AND USER_TYPE=1"  />			
 		</set>
 
 
 What I'm interested in is an example that will show me how to use the inverse attribute correctly, and any cascade styles, if necessary.
 
 Thanks,
 
 Jason. 
					
  
						
					 |