JPA - How to specify precision in automatically created SEQUENCE table?
posted 5 years ago
I'm using JPA with TopLink to automatically create Derby database tables. The problem I've encountered is with the automatically created SEQUENCE table that TopLink uses for generating Id numbers for the keys in several of these tables. Specifically, the SEQUENCE table's SEQ_COUNT field is defined as a DECIMAL(5,0) by default. This limits the generated id number to about 99901. However, after populating the database, I've exceeded the maximum number that the SEQ_COUNT field will support by the default: DECIMAL(5,0). To fix this, I had to manually delete the SEQUENCE table and manually recreate it using DECIMAL(31,0) to define the SEQ_COUNT field.
For each table in my database, I have the annotations for the Id as follows:
I cannot find any documentation that explains how to specify the precision for the SEQ_COUNT field for the SEQUENCE table (that is automatically generated by TopLink/JPA). So, my question(s) are:
(1) Is there a way to specify a JPA annotation that can specify the precision of the SEQ_COUNT field?
(2) If not, what would be a best practice to deal with this situation. Certainly I can't be the first person to encounter this limitation.
Any help/suggestions will be greatly appreciated!