Hello, I am using Hibernate 5.4.25.Final to perform CRUD operations in Oracle, Postgres and MS SQL DB’s. In a table where the auto generated key is an “int”, after a certain number of days, the “id” reaches the max value of (2^31 -1) and no moere records can be written until “DBCC CHECKIDENT (‘dbo.tbl’,RESEED,0);” operation is executed manually.
I wanted to find out if there is any way to perform the following operations using hibernate:
- Determine the max value (e.g. in this case it will be 2^31-1)
- If the auto generated value is equal to this max value, then execute reset id (e.g. execute “DBCC CHECKIDENT (‘dbo.tbl’,RESEED,0);”).
Thanks so much in advance for your help.