[CDO] commit in EmbeddedRepositoryExample [message #1868880] |
Wed, 24 July 2024 07:45  |
Eclipse User |
|
|
|
Hello,
In the EmbeddedRepositoryExample, I made some modifications to the main function, as follows:
CDOTransaction transaction = CDOFacade.INSTANCE.getTransaction();
CDOResource resource = transaction.getOrCreateResource("test1");
Company company = CompanyFactory.eINSTANCE.createCompany();
company.setName("Company 1");
resource.getContents().add(company);
transaction.commit();
company.setName("Company 2");
for (EObject object : resource.getContents())
{
if (object instanceof Company)
{
System.out.println(((Company)object).getName());
}
}
CDOResource resource2 = transaction.getOrCreateResource("test1");
for (EObject object : resource2.getContents())
{
if (object instanceof Company)
{
System.out.println(((Company)object).getName());
}
}
In this code, I changed the company name after the commit. However, when I retrieve the CDO resource again, the modification of the name is reflected. I was expecting that the modification would not be reflected because it occurred after the commit. Here is my output:
Company 2
Company 2
I use the release 4.25 of CDO
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06715 seconds