File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes JPA - How to specify precision in automatically created SEQUENCE table? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA - How to specify precision in automatically created SEQUENCE table?" Watch "JPA - How to specify precision in automatically created SEQUENCE table?" New topic
Author

JPA - How to specify precision in automatically created SEQUENCE table?

Barry Silk
Greenhorn

Joined: Mar 13, 2010
Posts: 1
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!
Barry
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA - How to specify precision in automatically created SEQUENCE table?