TopLink works with BigInteger and BigDecimal data types. It is not possible to use Long or Integer instead BigInteger because the precision of Integer is 10, the precision of Long is 20 and the precision of BigInteger is not limited. Most of the databases are limited the precision up to 38 but in some like PostgreSQL is possible up to 8000 or no limit for the last version.
So, how can I use Long with max precision of 20 digits where in the database is declared DECIMAL(36,0)? Miro. On 11/24/07, klaasjan elzinga <[EMAIL PROTECTED]> wrote: > > Is it an option to declare the id as a Long/Integer field ie of the > BigInteger? I think that will be the solution. And I don't think it is > a restriction, it is just not supported. > > KlaasJan > > On Nov 24, 2007 3:21 PM, Miroslav Nachev <[EMAIL PROTECTED]> wrote: > > Hi, > > > > Can I use BigInteger /DECIMAL(P,0)/ and BigDecimal as PrimaryKey ? This > is > > possible in any Database but OpenJPA throws an error: > > Exception in thread "main" <openjpa-1.1.0-SNAPSHOT-r420667:592964M fatal > > user error> org.apache.openjpa.persistence.ArgumentException: Type > "class > > test.DataObject" declares field "objectId" as a primary key, but keys of > > type "java.math.BigInteger" are not supported. > > > > Why is that restriction? > > > > > > Regards, > > Miro. > > >
