[jboss-user] [EJB3] - @SequenceGenerator initial value

Noa Drach do-not-reply at jboss.com
Mon Dec 6 12:31:01 EST 2010


Noa Drach [http://community.jboss.org/people/newway] created the discussion

"@SequenceGenerator initial value"

To view the discussion, visit: http://community.jboss.org/message/574564#574564

--------------------------------------------------------------
@Id
@GeneratedValue(strategy = SEQUENCE, generator = "SEQ_ACE_ACTIVE_CI")
@SequenceGenerator(name = "SEQ_ACE_ACTIVE_CI", sequenceName = "SEQ_ACE_ACTIVE_CI", allocationSize = 500)
I'm running on JBOSS 4.2.3.GA for java 6

in my entities I connect between a real DB sequence and the Id field in the following way


 
@Id
@GeneratedValue(strategy = SEQUENCE, generator = "SEQ_NAME")
@SequenceGenerator(name = "SEQ_NAME", sequenceName = "SEQ_NAME", allocationSize = 500)
 



I put the allocation size as 500 since after some performance tests i run i saw that prevents it from going to the DB for each insert and doing 

select seq.nextval from dual


- I'm using Oracle , and the above is probably not the exact syntax, just the general idea.

the thing is that although my sequence is defined with an initial value of 1000 in the DB is see that all my generated entities start with id 500000 and each time I restart my server it jumps in 500 and in the meanwhile if I look at my sequences I see that the don't progress above the initial value of 1000.

I feel stupid just asking this question, but if you can just explain to me what's missing in my understanding or point me to where this was already discussed I'll be grateful, since I couldn't find the explanation on my own. :-/
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/574564#574564]

Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101206/34cf63bb/attachment.html 


More information about the jboss-user mailing list