I have entity like below, but can’t undestand why when i add new record, generated id is 50, 51, 52… if select nextval('seq_text'); return 1523, 1524… Database: PostgreSQL.
Something wrong ?
@Entity
@SequenceGenerator(name = "seq_text", sequenceName = "seq_text")
public class Text {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_text")
private Integer id;
...
}
It appears that the declaration that you use is using HiLo generator.
Here is a discussion and workaround:
http://community.jboss.org/thread/107819?tstart=0
Proposed workaround is