-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Inserting a single value into an existing collection
PostPosted: Mon Aug 04, 2008 6:16 am 
Newbie

Joined: Mon Aug 04, 2008 6:04 am
Posts: 1
I have a Two objects : Batch and User
The relation is many to many between them.

User can belong to many batches.
Batch can have Many Users.


now i want to add a new User to an Existing Batch.


Mapping is as follows

<hibernate-mapping package="com.model">

<class name="Batch" table="Batch" dynamic-update="true"
dynamic-insert="true" select-before-update="false" >

<id name="batchId" type="long" column="BatchId">
<generator class="native"></generator>
</id>

<set name="users" table="Batch_User" cascade="save-update"
lazy="true" >
<key>
<column name="BatchId" not-null="true" />
</key>
<many-to-many class="BatchUser" column="UserId" />
</set>

</class>
</hibernate-mapping>



Please help me to add a new User to the existing Batch without deleting the existing users in the Batch.


Thanks in Advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 6:53 am 
Newbie

Joined: Thu Mar 27, 2008 11:45 am
Posts: 10
Location: Russia
Could you show xml mapping for BatchUser class

PS:
use tag [code] to show java or xml code - just press "code" button.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.