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

Andrus Adamchik closed CAY-1783.
--------------------------------

    Resolution: Fixed
    
> JdbcPkGenerator.longPkFromDatabase would throw an exception if the PK value 
> exceeds a range of Java int
> -------------------------------------------------------------------------------------------------------
>
>                 Key: CAY-1783
>                 URL: https://issues.apache.org/jira/browse/CAY-1783
>             Project: Cayenne
>          Issue Type: Bug
>    Affects Versions: 3.1B1, 3.2M1
>            Reporter: Andrus Adamchik
>            Priority: Minor
>             Fix For: 3.1B2, 3.2M1
>
>
> Don't have a unit test to prove it yet, so this is just based on the code 
> review of JdbcPkGenerator and its inner class PkRetrieveProcessor:
> protected long longPkFromDatabase(DataNode node, DbEntity entity) throws 
> Exception {
>         ...
>         PkRetrieveProcessor observer = new 
> PkRetrieveProcessor(entity.getName());
>         node.performQueries(queries, observer);
>         return observer.getId();
>     }
> final class PkRetrieveProcessor implements OperationObserver {
>         Number id;
>    ....
>         public int getId() {
>             if (id == null) {
>                 throw new CayenneRuntimeException("No key was retrieved for 
> entity "
>                         + entityName);
>             }
>             return id.intValue();
>         }
> This only affects those few DBs that do not override 'longPkFromDatabase' (H2 
> and HSQLDB?)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to