[
https://issues.apache.org/jira/browse/CAY-1728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13420139#comment-13420139
]
Andrus Adamchik commented on CAY-1728:
--------------------------------------
Related discussion on the dev list:
http://markmail.org/message/icr7seqazgsdtewc If we make this change, this Jira
will just go away by itself.
> Custom types used for PK are causing grief in relationships
> -----------------------------------------------------------
>
> Key: CAY-1728
> URL: https://issues.apache.org/jira/browse/CAY-1728
> Project: Cayenne
> Issue Type: Bug
> Components: Core Library
> Affects Versions: 3.1B1, 3.2M1
> Reporter: Andrus Adamchik
> Assignee: Andrus Adamchik
> Attachments: 0001-testing-custom-types-as-PK.patch
>
>
> 1. Map an entity with meaningful PK, type of that PK being a non-standard
> type for a given type of column (e.g. attached test case demonstrating the
> problem maps a VARCHAR column to java.util.UUID).
> 2. Map another entity with an FK to the first entity, and create a to-one
> relaionship.
> 3. Fetch entity 2 and try to read the relationship to entity 1. The result is
> a FaultFailureException similar to this one:
> org.apache.cayenne.FaultFailureException: [v.3.2M1-SNAPSHOT
> ${project.build.date} ${project.build.time}] Error resolving fault for
> ObjectId: <ObjectId:UuidPkEntity, ID=8251ae98-de42-404c-9cd0-9c1b29410604>
> and state (hollow). Possible cause - matching row is missing from the
> database.
> at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:316)
> at
> org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:174)
> at
> org.apache.cayenne.testdo.testmap.auto._UuidPkEntity.getId(_UuidPkEntity.java:26)
> at
> org.apache.cayenne.access.UUIDTest.testUUIDMeaningfulPkSelectViaRelationship(UUIDTest.java:107)
> The reason is that expected ObjectId of the target entity contains a value of
> type String instead of UUID, so expected and fetched ObjectId do not match,
> and Cayenne thinks there's no object for relationship.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira