tags:

views:

140

answers:

1

When I start my server and add an entry, the generated id will start with 1, 2, so on and so forth. After a restart, adding an entry would generate an id like 32,xxx. Another restart and adding of entry would generate an id like 65,xxx.

I don't know why this is happening.

Here's a snippet of the annotation I'm using for my id. I'm using Hibernate 3.4.0.GA.

@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private Long id;
A: 

What version of Hibernate are you using here? I've seen some issues about id generation with recent versions (like HHH-4228, HHH-4228 and another one about the hi-value being wrongly calculated that I can't find back) that have been fixed in Hibernate 3.5.2. Can you give it a try?

If this doesn't apply, what happen if you use allocationSize=1?

Pascal Thivent
We're using 3.4.0.GA. I've tried adding the allocationSize=1 and it isn't jumping anymore. However, I'm puzzled as to why they designed it to jump like that.
joeduardo