-->
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.  [ 3 posts ] 
Author Message
 Post subject: ID mapping
PostPosted: Mon Dec 05, 2005 3:26 am 
Newbie

Joined: Tue Nov 29, 2005 2:43 am
Posts: 9
I have mapped the id for an object as follows:
Code:
    <id name="metadataId" column="category_name_id" node="metadataid">
      <generator class="native"/>
    </id>

Is there any way to indicate to hibernate to use the ID if it is provided and if it is not provided then generate it? I used the replicate method to insert a record by providing the ID. But, it always generates.
I was trying to insert the record as an xml element using the dom4j.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 3:33 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
if you want to provide the value of the id, use the "assigned" generator. I am pretty sure you cannot have both.


Top
 Profile  
 
 Post subject: ID Mapping
PostPosted: Mon Dec 05, 2005 7:25 pm 
Newbie

Joined: Tue Nov 29, 2005 2:43 am
Posts: 9
I was thinking, session.replicate() will generate the id if not present. Otherwise, use what is provided regardless the mapping.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.