1 Reply Latest reply on Feb 27, 2011 2:38 PM by Noa Drach

    @SequenceGenerator initial value

    Noa Drach Novice
      @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.