This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JPA - How to specify precision in automatically created SEQUENCE table?
 
Similar Threads
Jpa/mysql issue
Pros & Cons on J2EE Table GenerationTypes
JPA EclipseLink SEQUENCE table does not exist
TOPLINK-41 for SQL Server 2005 and Identity Column
JPA - Many to Many Question