[
https://issues.apache.org/jira/browse/CAY-1807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13631666#comment-13631666
]
Andrus Adamchik commented on CAY-1807:
--------------------------------------
Thanks for the JIra. May I ask for a few details:
1. Do you have a stack trace?
2. Was the detached object mentioned here NEW before it was deleted?
> Replace a Detached object with new one on a relationship throws NPE
> --------------------------------------------------------------------
>
> Key: CAY-1807
> URL: https://issues.apache.org/jira/browse/CAY-1807
> Project: Cayenne
> Issue Type: Improvement
> Components: Core Library
> Affects Versions: 3.0.1
> Reporter: Manuel Sánchez
> Priority: Minor
>
> In the following scenario:
> I deleted and persistent object (gets detached) which was used in a
> relationship
> I replaced it with a new one at the end of a relathionship
> Cayenne records an ArcDeletedOperation with the detached object involved and
> throws a NPE when commiting.
> I solved the problem by disconecting the detached object from the
> relationship (set to null) and then assigning the new one; in two steps
> Cayenne could check if its a detached object on that ArcDeletedOperation and
> say so instead of throwing a NPE, or not recording any action, .. something
> more elegant than a NPE
> Thanks
--
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