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.  [ 1 post ] 
Author Message
 Post subject: How to assign identificator with sequence
PostPosted: Tue Apr 14, 2009 6:20 pm 
Newbie

Joined: Sun Dec 28, 2008 2:58 pm
Posts: 5
Hello...I have a simple question, but I really don't know how to solve it.

I'm using this generator

<generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
<param name="initial_value">100</param>
<param name="sequence_name">UserSequence</param>
</generator>

The sequence starts at 100 on purpose, because I need to insert some users with pre-defined ids (admin == id - 0)...and that is the problem...I have sequence, so I cannot save it, because I have specified id (and I am not using assigned generator), if i try to persist it, it is detached entity...and I cannot use assigned ID's, because except of these few predefined users I want hibernate to take care of ids for me....and i really dont want to insert it via sql, because I dont want to depend on specific SQL...

Thanks (and sorry for my english).


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

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.