Skip to main content



      Home
Home » Modeling » EMF » Correct usage of CDO Views
Correct usage of CDO Views [message #1668506] Thu, 12 March 2015 10:15 Go to next message
Eclipse UserFriend
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 10:20 Go to previous messageGo to next message
Eclipse UserFriend
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 10:33 Go to previous messageGo to next message
Eclipse UserFriend
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] Thu, 12 March 2015 21:57 Go to previous messageGo to next message
Eclipse UserFriend
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 07:50 Go to previous messageGo to next message
Eclipse UserFriend
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 10:15 Go to previous messageGo to next message
Eclipse UserFriend
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 12:24 Go to previous messageGo to next message
Eclipse UserFriend
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 04:07 Go to previous message
Eclipse UserFriend
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: Tue Jul 08 23:33:54 EDT 2025

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

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

Back to the top