Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] What is the best way to check if EMF resource has been updated in the datastore?
[Teneo] What is the best way to check if EMF resource has been updated in the datastore? [message #113832] Tue, 04 March 2008 09:42 Go to next message
Eclipse UserFriend
Originally posted by: vnikolov.us.ibm.com

Hello,


I was wondering what is the best way (performance wise) to check if EMF
resource has been updated in the DB i.e. to find out if there are any
differences between the EMF resource in the memory and the data in the DB.

I'm using Teneo with JPOX.

For example: My application loads a resource and outputs all
elements.(like "Load the resource" section here:
http://www.elver.org/jpox/tutorial1/tutorial1_5.html)
Then some other part of the code adds another element in the db.

In order to get the updates I should reload the resource.
But how I can find out if there is difference between the EMF resource
in the memory and the resource representation in the DB without calling
resource.load()?

Thanks,
Vladimir
Re: [Teneo] What is the best way to check if EMF resource has been updated in the datastore? [message #113854 is a reply to message #113832] Tue, 04 March 2008 11:20 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Vladimir,
Assuming that you only want to check for updates of currently loaded objects then you can use the
getNonResolvingAllContents method on the jpoxresource to get an iterator which does not load lazy
loaded lists. Then iterate over it and check if the in-memory version is different from the version
in the db. The in-memory version number can be obtained by casting to PersistenceCapabale and
calling jdoVersion, the db version is present in the e_version column (you need to do a query to get
it).

gr. Martin

Vladimir Nikolov wrote:
> Hello,
>
>
> I was wondering what is the best way (performance wise) to check if EMF
> resource has been updated in the DB i.e. to find out if there are any
> differences between the EMF resource in the memory and the data in the DB.
>
> I'm using Teneo with JPOX.
>
> For example: My application loads a resource and outputs all
> elements.(like "Load the resource" section here:
> http://www.elver.org/jpox/tutorial1/tutorial1_5.html)
> Then some other part of the code adds another element in the db.
>
> In order to get the updates I should reload the resource.
> But how I can find out if there is difference between the EMF resource
> in the memory and the resource representation in the DB without calling
> resource.load()?
>
> Thanks,
> Vladimir


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] What is the best way to check if EMF resource has been updated in the datastore? [message #615606 is a reply to message #113832] Tue, 04 March 2008 11:20 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Vladimir,
Assuming that you only want to check for updates of currently loaded objects then you can use the
getNonResolvingAllContents method on the jpoxresource to get an iterator which does not load lazy
loaded lists. Then iterate over it and check if the in-memory version is different from the version
in the db. The in-memory version number can be obtained by casting to PersistenceCapabale and
calling jdoVersion, the db version is present in the e_version column (you need to do a query to get
it).

gr. Martin

Vladimir Nikolov wrote:
> Hello,
>
>
> I was wondering what is the best way (performance wise) to check if EMF
> resource has been updated in the DB i.e. to find out if there are any
> differences between the EMF resource in the memory and the data in the DB.
>
> I'm using Teneo with JPOX.
>
> For example: My application loads a resource and outputs all
> elements.(like "Load the resource" section here:
> http://www.elver.org/jpox/tutorial1/tutorial1_5.html)
> Then some other part of the code adds another element in the db.
>
> In order to get the updates I should reload the resource.
> But how I can find out if there is difference between the EMF resource
> in the memory and the resource representation in the DB without calling
> resource.load()?
>
> Thanks,
> Vladimir


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:[Teneo] What is the best way to check if EMF resource has been updated in the datastore?
Next Topic:[Announce] UML2 Tools at EclipseCon 2008
Goto Forum:
  


Current Time: Sat Apr 20 03:01:57 GMT 2024

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

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

Back to the top