I use Hibernate with Sybase to create a new record :
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
This is my query to create a field in the DB :
ID bigint IDENTITY NOT NULL
After creating the first record the ID is 50000000000000001. What is wrong? I want the first value to be 1.
It probably occurred after an abnormal shutdown of Sybase. There is a good explanation here.
The best way to "recover" it is running the sp_chgattribute
command, like this:
sp_chgattribute "table_name", "identity_gap", set_number