Description
Subhashini Krishnamurthy created an issue — 11th October 2012, 19:46:08:
We have three entities BranchLocation, BusinessUnit and BusinessUnitContainsBranchLocations which represents the association between BranchLocations and BusinessUnits.
A BranchLocation can belong to only one BusinessUnit. This is represented by a one-to-one association between BranchLocation and BusinessUnitContainsBranchLocations. This one-to-one association does not share the PK, instead uses the property-ref.
Here is the test scenario:
- User1 gets Branch1.
- User2 gets Branch1 and associates it with BusinessUnit1.
- User1 associates Branch1 with another BusinessUnit2 and saves the original Branch1 which is a detached object. At this point, User1 should get a StaleData error. Instead a Unique Key violation is thrown.
I also see that when User2 saves Branch1 with a new association to BusinessUnit1, the BranchLocation object's version does not get incremented like what you see with one-to-many associations or other property updates.
Attached is a test case to demonstrate the issue.
This is critical since this prevents us from doing stale data checking with one-to-one associations.
Subhashini Krishnamurthy added a comment — 11th October 2012, 19:49:33:
Test case to demonstrate that stale data checking does not work for one-to-one associations.