Db-generated PK type misma
--------------------------

                 Key: CAY-823
                 URL: https://issues.apache.org/cayenne/browse/CAY-823
             Project: Cayenne
          Issue Type: Bug
          Components: Cayenne Core Library
    Affects Versions: 3.0
         Environment: MySQL 5, 3.1 and 5.0 drivers
            Reporter: Andrus Adamchik
            Assignee: Andrus Adamchik
             Fix For: 3.0


java class of a DB-generated PK turns out to be undefined and generally not 
matching the type of column it is used for. E.g. for a JDBC int column, the 
default Java mapping is  java.lang.Integer. When a generated key is configured 
for this column all db's return different values:

MySQL 5/Connector J 3.1.13 BigInteger
MySQL 5/Connector J 5.0.6   Long
Derby 10.2                            BigDecimal

To be fair JDBC spec does not specify what should be returned, so the vendors 
are doing what they want. 

This causes a number of problems in Cayenne. One specific exception - although 
we've hacked ObjectId comparison algorithm to unwrap the numbers and compare 
their numeric values, IncrementalFaultList compares DataRows and fails to match 
Objects against the id datarows:

/-- Encapsulated exception ------------\
org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT Jun 28 2007 
08:48:22] Can't find id for {<ObjectId:BlaBla, ID=85>; committed; [...]}
        at 
org.apache.cayenne.access.IncrementalFaultList$IncrementalListHelper.updateWithResolvedObjectInRange(IncrementalFaultList.java:779)
        at 
org.apache.cayenne.access.IncrementalFaultList.resolveInterval(IncrementalFaultList.java:427)
        at 
org.apache.cayenne.access.IncrementalFaultList.get(IncrementalFaultList.java:613)


I think we need to explicitly pass the Java type we expect for the ID inside 
the BatchAction

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to