Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Correct usage of CDO Views
Correct usage of CDO Views [message #1668506] Thu, 12 March 2015 14:15 Go to next message
Daniel Seybold is currently offline Daniel SeyboldFriend
Messages: 14
Registered: October 2014
Junior Member
Hi guys,

I'm currently working with a CDO Server and a Client accessing the server.

I'm not sure what is the correct use of the CDO views.

Can it lead to problems if I use the views in this way:

view v = session.openView()
model = resource.getContents().get(0);
v.closeView();
model.doSth(); 


Thank you in advance for your help!

Cheers,
Daniel
Re: Correct usage of CDO Views [message #1668515 is a reply to message #1668506] Thu, 12 March 2015 14:20 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Daniel,

CDOView is usable to a read-only access, if you need read-write access
use a CDOTransaction :

CDOTransaction transaction = session.openTransaction();

Best Regards.


Le 12/03/2015 15:15, Daniel Seybold a écrit :
> Hi guys,
>
> I'm currently working with a CDO Server and a Client accessing the server.
>
> I'm not sure what is the correct use of the CDO views.
>
> Can it lead to problems if I use the views in this way:
>
> view v = session.openView()
> model = resource.getContents().get(0);
> v.closeView();
> model.doSth();
>
> Thank you in advance for your help!
>
> Cheers,
> Daniel



--
Esteban Dugueperoux - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Correct usage of CDO Views [message #1668532 is a reply to message #1668515] Thu, 12 March 2015 14:33 Go to previous messageGo to next message
Daniel Seybold is currently offline Daniel SeyboldFriend
Messages: 14
Registered: October 2014
Junior Member
Hi,

thanks for your quick answer.

Now I have a follow up question:

Is the model completely loaded by the
model = resource.getContents().get(0);
command (assuming there is only one root element in this resource) or does the CDO server lazy loading?

Because by
v.closeView();
model.doSth();


I assume the whole model is loaded.

Am I right with this assumption?

Cheers,
Daniel
Re: Correct usage of CDO Views [message #1669821 is a reply to message #1668532] Fri, 13 March 2015 01:57 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 12.03.2015 um 07:33 schrieb Daniel Seybold:
> Hi,
>
> thanks for your quick answer.
>
> Now I have a follow up question:
>
> Is the model completely loaded by the model = resource.getContents().get(0); command (assuming there is only one root
> element in this resource) or does the CDO server lazy loading?
The latter.

>
> Because by
> v.closeView();
> model.doSth();
You must not close the view until you're done accessing the model that's provided (and managed) by the view/transaction.

>
>
> I assume the whole model is loaded.
No. Unless you've configured prefetching to load it completely.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



>
> Am I right with this assumption?
>
> Cheers,
> Daniel


Re: Correct usage of CDO Views [message #1670926 is a reply to message #1669821] Fri, 13 March 2015 11:50 Go to previous messageGo to next message
Daniel Seybold is currently offline Daniel SeyboldFriend
Messages: 14
Registered: October 2014
Junior Member
Hi Eike,

thanks a lot. for your answer

This solved all my open issues.

Cheers,
Daniel
Re: Correct usage of CDO Views [message #1671227 is a reply to message #1670926] Fri, 13 March 2015 14:15 Go to previous messageGo to next message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 59
Registered: April 2014
Member
Hi,

I have got a related question to the issue about keeping open views/transactions:
is it okay to keep a transaction open for the whole runtime of my application or
should I rather use a view and open the transaction only on demand for a short time?
Re: Correct usage of CDO Views [message #1671480 is a reply to message #1671227] Fri, 13 March 2015 16:24 Go to previous messageGo to next message
Daniel Seybold is currently offline Daniel SeyboldFriend
Messages: 14
Registered: October 2014
Junior Member
Hi,

in my understanding of the CDO Server you should use Views if you are just reading the models.

Transactions should be used if you want to write to your models.

E.g. you can open a View (keep the View open), read models and if you want to write just open a Transaction, execute the write actions and commit the Transaction.
If you need to write again later you can open another Transaction.

Cheers,
Daniel
Re: Correct usage of CDO Views [message #1675856 is a reply to message #1671227] Sun, 15 March 2015 08:07 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 13.03.2015 um 07:15 schrieb Alexander Klatt:
> Hi,
>
> I have got a related question to the issue about keeping open views/transactions: is it okay to keep a transaction
> open for the whole runtime of my application or should I rather use a view and open the transaction only on demand for
> a short time?
Both approaches are possible and common practice.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:Figure view different from Figure Gallery (during run-time)
Next Topic:How to extend an ecore meta model
Goto Forum:
  


Current Time: Wed Apr 24 15:53:40 GMT 2024

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

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

Back to the top