Issue Details (XML | Word | Printable)

Key: CAY-706
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: damir
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Cayenne

ObjectIdQuery should check datatype of key

Created: 13/Nov/06 11:40 AM   Updated: 13/Nov/06 11:40 AM
Return to search
Component/s: Cayenne Core Library
Affects Version/s: 1.2 branch, 2.0 branch
Fix Version/s: None

Time Tracking:
Not Specified


 Description  « Hide
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?

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no subversion log entries for this issue yet.