Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 352191

Summary: Locking detached elements
Product: [Modeling] EMF Reporter: Alex Lagarde <alex.lagarde>
Component: cdo.coreAssignee: Eike Stepper <stepper>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: caspar_d
Version: 4.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Fix
none
Fix v2 none

Description Alex Lagarde CLA 2011-07-15 05:39:06 EDT
As it has been discussed on the forum : http://www.eclipse.org/forums/index.php/t/217079/

it is possible to lock detached elements using a CDOTransactionHandler1.

JUnit tests should be written to ensure that this usecase works correctly
Comment 1 Eike Stepper CLA 2011-08-04 07:34:01 EDT
Created attachment 200903 [details]
Fix

It turns out that TRANSIENT (detached) objects can not be locked through CDOObject.cdoXyzLock().lock() because they have no view pointer anymore. This situation is detected and an IllegalStateException thrown with the hint to cll CDOView.lockObjects() instead.
Comment 2 Eike Stepper CLA 2011-08-04 07:34:43 EDT
Test is in org.eclipse.emf.cdo.tests.LockingManagerTest.testLockDetached()
Comment 3 Eike Stepper CLA 2011-08-04 11:14:20 EDT
Created attachment 200922 [details]
Fix v2
Comment 4 Eike Stepper CLA 2011-08-04 11:15:22 EDT
Committed revision 8864
Comment 5 Eike Stepper CLA 2012-09-21 07:16:22 EDT
Closing.