DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Key: NUCCORE-647
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Unassigned
Reporter: Chris Colman
Votes: 0
Watchers: 0

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

Attaching an object in long term transaction causes updates made in other PM to be missed, even after starting new transaction

Created: 17/Feb/11 06:33 AM   Updated: 07/Mar/11 05:34 PM   Resolved: 18/Feb/11 09:15 AM
Component/s: Cache, Persistence, Queries, Transactions
Affects Version/s: 2.2.3
Fix Version/s: None

File Attachments: 1. Zip Archive (10 kB)

Windows XP

Datastore: HSQL
Severity: Development

 Description  « Hide
Attaching to a new object immediately after committing the transaction in which it was first persisted seems to ruin it's chances of being updated in transactions in the future to reflect changes made in another PM.

The testcase prints either INCORRECT TYPE (if fails) or CORRECT TYPE (if succeeds).
By commenting out the line that reattaches after committing (near line 205) one can make the test succeed.

Note: On occassions an OptimisticVerificationException has even been thrown which makes me think that DN believes the attached object to be dirty even though it has not been changed at all.

Sort Order: Ascending order - Click to sort in descending order
Chris Colman added a comment - 17/Feb/11 06:34 AM
Standard test case to demonstrate the problem.

Andy Jefferson added a comment - 17/Feb/11 10:19 AM
You can easily see if things are dirty in a detached object, by using the provided methods on NucleusJDOHelper. You can also see what is happening by looking at the DN log. These are the first points of call in debugging.

Chris Colman added a comment - 17/Feb/11 01:02 PM - edited
Is there anyway that an already persisted object can become dirty without changing any of its attributes?

In any case, the testcase is fully reproducible - it's not intermittent.

Chris Colman added a comment - 18/Feb/11 02:16 AM
DOH! Forgot to call refresh!! Refreshing/updating does not occur automatically with an attached object, an explicit refresh(object) or refreshAll() is required after attaching...

You can mark this issue as 'NOT A BUG' :)

Andy Jefferson added a comment - 18/Feb/11 09:15 AM
Glad you got it working