|[CDO] Legacy model changes not comitted [message #1426601]
||Fri, 19 September 2014 01:00
| Roza Ghamari
Registered: January 2013
I am using the Hibernate Store and QuickStart example to programaticaly get my object from server and make some changes and commit the transaction back. My model is a legacy model and I cannot regenrate and make it a CDOModel because the super classes are from alibrary that are not CDO models. |
When I run the test with the CDO example model it works fine and it catches the changes and comitts makes the changes. However, when I run the same example on instances of my own model, after the first commit the changes on the model are not caught. As a result when I get the transactioninfo it has no commitdata.
When I try to use the EMF Editor and CDO Session viewer in Eclipse instance to create the model and make changes, it works fine and changes are committed.
I debugged in the code and I saw the isDirty flag doesn't get set when I call the setters in my object. Also, the eNotificationRequired in the setter returns false, which is because no Adapters are registered.
So I am wondering what I need to do to enable CDo on my legacy model for commits and updates programatically.
Also, if there is any way to regernate a cdo model that is extending a non-cdo model please let me know.
The code sample is:
final CDOSession session = openSession();
final CDOTransaction transaction = session.openTransaction();
// get/create a resource
CDOResource resource = transaction.getOrCreateResource("/res4");
// clear any previous data
resource.getContents().clear(); //this sets the isDIrty to true
MyClass1 res = MyFactory.eINSTANCE.MyClass1();
MyClass2 des = MyFactory.eINSTANCE.MyClass2();
MyClass3 md= MyFactory.eINSTANCE.MyClass3();
System.err.println(transaction.commit()); //the first commit works correctly
System.err.println(transaction.commit()); //this commit doesn't catch any changes
[Updated on: Fri, 19 September 2014 01:05]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02355 seconds