Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Confused on Sequence and allocationSize

So,
I am connecting to an oracle 9i DB.

I have a simple entity with a sequence based pk.

I added the annotations like so:

      @Id
	@SequenceGenerator(name="USER_PROFILE_SEQ",
sequenceName="REDACTED_USER_PROFILE_SEQ")
    @GeneratedValue(strategy=GenerationType.SEQUENCE,
generator="USER_PROFILE_SEQ")

Every single insert the sequence used for the Pk seemed to be some
random number, smaller than the actual value of the sequence, even
though I could see the sequence being selected in the logs.

Then I noticed it was not random, but 50 minus the actual value of the
sequence. I remembered a post on this list about the default value for
allocationSize being 50, so i added an allocationSize=1 (to match my
sequence) to my @SequenceGenerator and we were back in business.

Now the question of the hour why was it subtracting 50 from the
sequence? EL apparantly does a nextval - (allocation size) on the
sequence (but not if the allocation size is 1?)

Also, why is the default value 50 to begin with?

Thanks!
Tim


Back to the top