-->
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: How to create hibernate seq which start with other than one
PostPosted: Tue Oct 12, 2010 9:20 am 
Newbie

Joined: Wed Aug 25, 2010 4:35 am
Posts: 8
Hi
I want to generate sequence which starts with 5 (not with 1)
below is the code which generate sequence which starts with one
can you please guide me , how to start sequence with 5
Code:
<id name="id"
    column="id"   
    type="long"   
    >
    <generator class="sequence">
    <param name="sequence">webpage_seq</param>
   
    </generator>
</id>


Thanks...


Top
 Profile  
 
 Post subject: Re: How to create hibernate seq which start with other than one
PostPosted: Wed Oct 13, 2010 3:57 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
It seems like the enhanced sequence generator has this functionality. See http://docs.jboss.org/hibernate/stable/ ... d-enhanced


Top
 Profile  
 
 Post subject: Re: How to create hibernate seq which start with other than one
PostPosted: Thu Oct 14, 2010 5:55 am 
Newbie

Joined: Wed Aug 25, 2010 4:35 am
Posts: 8
Thanks nordborg
I have used
Code:
<generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
   <param name="sequence_name">footer_seq</param>
   <param name="initial_value">5</param>
   <param name="increment_size">1</param>
   <param name="optimizer">none</param>
</generator>


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.