Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Are CDO Transactions transparent?
Are CDO Transactions transparent? [message #124355] Sat, 31 May 2008 03:27 Go to next message
Al B is currently offline Al BFriend
Messages: 130
Registered: July 2009
Senior Member
Hi,

According to Eike Stepper (see link to post below), transactions are
transparent and we don't need to worry about them when editing our EMF
model. If that's the case, how do we control transactions when we need to,
for instance, say I change several fields in a model, but don't want to
have them sent over the wire until I hit the "save" button?

http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 1555.html

Thank you in advance!
Re: Are CDO Transactions transparent? [message #124394 is a reply to message #124355] Sat, 31 May 2008 17:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

This is a multi-part message in MIME format.
--------------000707030305000104080206
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

AJ,

A CDOTransaction is transparently associated with a resource set and you
can work with the contained resources and objects as usual without
bothering about the technical internals of the transaction. That said,
usually, depending on your application design, you have also access to
the transaction itself and cann call methods like commit(), rollback()
and setSavePoint() (coming soon). A common pattern is the following:

| CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration();
configuration.setConnector(connector);
configuration.setRepositoryName("my-repo");

CDOSession session = configuration.openSession();
session.getPackageRegistry().putEPackage(Model1Package.eINST ANCE);

CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource");

*EObject object = Model1Factory.eINSTANCE.createCompany();
resource.getContents().add(object);
*
transaction.commit();
session.close();|


Note that in the bold code region you can work with the resource, its
resource set and the contained objects as usual. But you can, if you
want also use the special CDO API in addition at any point in time.

Btw. when you click Save in the shipped CDO editor under the covers a
commit of the transaction that is associated with the resources set of
the editor is triggered.

Cheers
/Eike



AJ schrieb:
> Hi,
>
> According to Eike Stepper (see link to post below), transactions are
> transparent and we don't need to worry about them when editing our EMF
> model. If that's the case, how do we control transactions when we need
> to, for instance, say I change several fields in a model, but don't
> want to have them sent over the wire until I hit the "save" button?
>
> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 1555.html
>
> Thank you in advance!
>

--------------000707030305000104080206
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
AJ,<br>
<br>
A CDOTransaction is transparently associated with a resource set and
you can work with the contained resources and objects as usual without
bothering about the technical internals of the transaction. That said,
usually, depending on your application design, you have also access to
the transaction itself and cann call methods like commit(), rollback()
and setSavePoint() (coming soon). A common pattern is the following:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff">
Re: Are CDO Transactions transparent? [message #124424 is a reply to message #124394] Sat, 31 May 2008 17:59 Go to previous message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

This is a multi-part message in MIME format.
--------------060506000509030309010107
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

AJ,

It might also be of interest that you can open several transactions on a
single session. Then you get several resource sets (one per transaction)
and you can work with them concurrently. The modeled state of the
objects is automatically shared among all transactions of the session
until one transaction modifies that state. All that happens
transparently under the covers.

Cheers
/Eike



Eike Stepper schrieb:
> AJ,
>
> A CDOTransaction is transparently associated with a resource set and
> you can work with the contained resources and objects as usual without
> bothering about the technical internals of the transaction. That said,
> usually, depending on your application design, you have also access to
> the transaction itself and cann call methods like commit(), rollback()
> and setSavePoint() (coming soon). A common pattern is the following:
>
> | CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration();
> configuration.setConnector(connector);
> configuration.setRepositoryName("my-repo");
>
> CDOSession session = configuration.openSession();
> session.getPackageRegistry().putEPackage(Model1Package.eINST ANCE);
>
> CDOTransaction transaction = session.openTransaction();
> CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource");
>
> *EObject object = Model1Factory.eINSTANCE.createCompany();
> resource.getContents().add(object);
> *
> transaction.commit();
> session.close();|
>
>
> Note that in the bold code region you can work with the resource, its
> resource set and the contained objects as usual. But you can, if you
> want also use the special CDO API in addition at any point in time.
>
> Btw. when you click Save in the shipped CDO editor under the covers a
> commit of the transaction that is associated with the resources set of
> the editor is triggered.
>
> Cheers
> /Eike
>
>
>
> AJ schrieb:
>> Hi,
>>
>> According to Eike Stepper (see link to post below), transactions are
>> transparent and we don't need to worry about them when editing our
>> EMF model. If that's the case, how do we control transactions when we
>> need to, for instance, say I change several fields in a model, but
>> don't want to have them sent over the wire until I hit the "save"
>> button?
>>
>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 1555.html
>>
>> Thank you in advance!
>>

--------------060506000509030309010107
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
AJ,<br>
<br>
It might also be of interest that you can open several transactions on
a single session. Then you get several resource sets (one per
transaction) and you can work with them concurrently. The modeled state
of the objects is automatically shared among all transactions of the
session until one transaction modifies that state. All that happens
transparently under the covers.<br>
<br>
Cheers<br>
/Eike<br>
<br>
<br>
<br>
Eike Stepper schrieb:
<blockquote cite="mid:g1s0ou$a7o$1@build.eclipse.org" type="cite">
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
AJ,<br>
<br>
A CDOTransaction is transparently associated with a resource set and
you can work with the contained resources and objects as usual without
bothering about the technical internals of the transaction. That said,
usually, depending on your application design, you have also access to
the transaction itself and cann call methods like commit(), rollback()
and setSavePoint() (coming soon). A common pattern is the following:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; ">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = --><!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff">
Re: Are CDO Transactions transparent? [message #619120 is a reply to message #124355] Sat, 31 May 2008 17:09 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000707030305000104080206
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

AJ,

A CDOTransaction is transparently associated with a resource set and you
can work with the contained resources and objects as usual without
bothering about the technical internals of the transaction. That said,
usually, depending on your application design, you have also access to
the transaction itself and cann call methods like commit(), rollback()
and setSavePoint() (coming soon). A common pattern is the following:

| CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration();
configuration.setConnector(connector);
configuration.setRepositoryName("my-repo");

CDOSession session = configuration.openSession();
session.getPackageRegistry().putEPackage(Model1Package.eINST ANCE);

CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource");

*EObject object = Model1Factory.eINSTANCE.createCompany();
resource.getContents().add(object);
*
transaction.commit();
session.close();|


Note that in the bold code region you can work with the resource, its
resource set and the contained objects as usual. But you can, if you
want also use the special CDO API in addition at any point in time.

Btw. when you click Save in the shipped CDO editor under the covers a
commit of the transaction that is associated with the resources set of
the editor is triggered.

Cheers
/Eike



AJ schrieb:
> Hi,
>
> According to Eike Stepper (see link to post below), transactions are
> transparent and we don't need to worry about them when editing our EMF
> model. If that's the case, how do we control transactions when we need
> to, for instance, say I change several fields in a model, but don't
> want to have them sent over the wire until I hit the "save" button?
>
> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 1555.html
>
> Thank you in advance!
>

--------------000707030305000104080206
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
AJ,<br>
<br>
A CDOTransaction is transparently associated with a resource set and
you can work with the contained resources and objects as usual without
bothering about the technical internals of the transaction. That said,
usually, depending on your application design, you have also access to
the transaction itself and cann call methods like commit(), rollback()
and setSavePoint() (coming soon). A common pattern is the following:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff">


Re: Are CDO Transactions transparent? [message #619122 is a reply to message #124394] Sat, 31 May 2008 17:59 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060506000509030309010107
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

AJ,

It might also be of interest that you can open several transactions on a
single session. Then you get several resource sets (one per transaction)
and you can work with them concurrently. The modeled state of the
objects is automatically shared among all transactions of the session
until one transaction modifies that state. All that happens
transparently under the covers.

Cheers
/Eike



Eike Stepper schrieb:
> AJ,
>
> A CDOTransaction is transparently associated with a resource set and
> you can work with the contained resources and objects as usual without
> bothering about the technical internals of the transaction. That said,
> usually, depending on your application design, you have also access to
> the transaction itself and cann call methods like commit(), rollback()
> and setSavePoint() (coming soon). A common pattern is the following:
>
> | CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration();
> configuration.setConnector(connector);
> configuration.setRepositoryName("my-repo");
>
> CDOSession session = configuration.openSession();
> session.getPackageRegistry().putEPackage(Model1Package.eINST ANCE);
>
> CDOTransaction transaction = session.openTransaction();
> CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource");
>
> *EObject object = Model1Factory.eINSTANCE.createCompany();
> resource.getContents().add(object);
> *
> transaction.commit();
> session.close();|
>
>
> Note that in the bold code region you can work with the resource, its
> resource set and the contained objects as usual. But you can, if you
> want also use the special CDO API in addition at any point in time.
>
> Btw. when you click Save in the shipped CDO editor under the covers a
> commit of the transaction that is associated with the resources set of
> the editor is triggered.
>
> Cheers
> /Eike
>
>
>
> AJ schrieb:
>> Hi,
>>
>> According to Eike Stepper (see link to post below), transactions are
>> transparent and we don't need to worry about them when editing our
>> EMF model. If that's the case, how do we control transactions when we
>> need to, for instance, say I change several fields in a model, but
>> don't want to have them sent over the wire until I hit the "save"
>> button?
>>
>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 1555.html
>>
>> Thank you in advance!
>>

--------------060506000509030309010107
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
AJ,<br>
<br>
It might also be of interest that you can open several transactions on
a single session. Then you get several resource sets (one per
transaction) and you can work with them concurrently. The modeled state
of the objects is automatically shared among all transactions of the
session until one transaction modifies that state. All that happens
transparently under the covers.<br>
<br>
Cheers<br>
/Eike<br>
<br>
<br>
<br>
Eike Stepper schrieb:
<blockquote cite="mid:g1s0ou$a7o$1@build.eclipse.org" type="cite">
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
AJ,<br>
<br>
A CDOTransaction is transparently associated with a resource set and
you can work with the contained resources and objects as usual without
bothering about the technical internals of the transaction. That said,
usually, depending on your application design, you have also access to
the transaction itself and cann call methods like commit(), rollback()
and setSavePoint() (coming soon). A common pattern is the following:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; ">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = --><!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff">


Previous Topic:[CDO] Does CDO fit in our scenario?
Next Topic:EMF Compare - Comparing XSD (XML schema)
Goto Forum:
  


Current Time: Fri Apr 19 15:00:36 GMT 2024

Powered by FUDForum. Page generated in 0.02344 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top