-->
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: How to set an ID manually when using a Hib-Generator class??
PostPosted: Mon Jan 17, 2005 1:51 pm 
Newbie

Joined: Mon Jan 17, 2005 1:37 pm
Posts: 1
Hi,

I have the following question concerning generators. I hope someone out there can help me. Thanks a lot for every reply!!

I have a persistent class with an Integer-ID. Normally I want Hibernate to set this ID automatically. That is why I mappd it like this:

<id name="productId" column="productId" type="integer">
<generator class="increment"/>
</id>

This works well, but sometimes I need to set the ID of an Object by myself.....I tried to do this by coding
"product.setProductId(new Integer(555))"

,but Hibernate ignores this....

IS THERE A POSSIBILITY TO MIX the ID-GENERATING??

Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 17, 2005 2:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No - you could probably write your own ID generator for that, I think exactly this question was already once solved on the forum, have a look


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.