[ 
https://issues.apache.org/jira/browse/CAY-2964?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrus Adamchik updated CAY-2964:
---------------------------------
    Summary: ClassCastException for non-generated PKs  (was: ClassCastException 
for PKs on Oracle)

> ClassCastException for non-generated PKs
> ----------------------------------------
>
>                 Key: CAY-2964
>                 URL: https://issues.apache.org/jira/browse/CAY-2964
>             Project: Cayenne
>          Issue Type: Task
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>            Priority: Major
>             Fix For: 5.0-M3
>
>
> On adapters that do not support JDBC generated keys (Oracle, Firebird, 
> FrontBase and default JdbcAdapter), committing a new object whose generated 
> meaningful PK is mapped to an ObjAttribute Java type different from the DB 
> column type throws:
> {noformat}
> java.lang.ClassCastException: class java.lang.Integer cannot be cast 
> to class java.math.BigInteger
> at ReplacementIdVisitor.updateId(ReplacementIdVisitor.java:106){noformat}
>  Root cause: JdbcPkGenerator.generatePk() types the generated value from the 
> DB column only (Long for BIGINT, Integer otherwise). 
> ReplacementIdVisitor.updateId() then writes it directly into the 
> meaningful-PK property without coercion. Adapters using JDBC generated keys 
> are unaffected because BatchAction.typeForGeneratedPK() already coerces to 
> the ObjAttribute type.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to