cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAY-1783) JdbcPkGenerator.longPkFromDatabase would throw an exception if the PK value exceeds a range of Java int
Date Wed, 26 Dec 2012 07:02:12 GMT
Andrus Adamchik created CAY-1783:
------------------------------------

             Summary: 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


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

Mime
View raw message