ObjectIdQuery should check datatype of key
------------------------------------------

         Key: CAY-706
         URL: http://issues.apache.org/cayenne/browse/CAY-706
     Project: Cayenne
        Type: Bug

  Components: Cayenne Core Library  
    Versions: 1.2 [STABLE], 2.0 [STABLE]    
    Reporter: Damir Bijuklic
    Priority: Minor


There is possibility of getting 'duplicate' entries in DataRowStore.snapshots 
by using SelectQuery and ObjectIdQuery.

For example if we have database table 'items', with short primary key item_id, 
when we do the following DataRowStore will have duplicate entries:

1. get item by Short id with SelectQuery
2. get item via DataObjectUtils.objectForPk with String for PK

The second query successfully fetches object from database even though it uses 
String datatype for PK, but it creates different ObjectID - with string instead 
of short.
This creates some confusion because now DataRowStore holds duplicate entries 
for one database row.

ObjectIdQuery should probably check for correct datatype of pk to prevent this 
situation?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/cayenne/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to