Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Getting locally created, modified and/or deleted objects from a CDOResource or a CDOView?
[CDO] Getting locally created, modified and/or deleted objects from a CDOResource or a CDOView? [message #508520] Tue, 19 January 2010 10:12 Go to next message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 19
Registered: July 2009
Location: Switzerland
Junior Member
How do one retrieve the current changes in a CDOView e.g. to get added, modified and deleted objects since the last save within the session?

If I e.g. do a consistency check for a unique name I can successfully send an SQL query to the database using CDOView createQuery (CDO v.3). The result does, however, not include any newly created (or deleted) objects not yet saved to the database. This is of course not surprising and an expected behaviour, but I am looking for a way to also iterate through the "delta"(?) in order to include objects not yet persisted and exclude deleted ones.

[Updated on: Tue, 19 January 2010 10:15]

Report message to a moderator

Re: [CDO] Getting locally created, modified and/or deleted objects from a CDOResource or a CDOView? [message #508527 is a reply to message #508520] Tue, 19 January 2010 10:22 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Bjoern,

Comments below...


Bjoern Sundin schrieb:
> How do one retrieve the current changes in a CDOView
Local changes can only happen in a CDOTransaction (which extends
CDOView). There you find getters for all kinds of changes. These getters
accumulate the more detailed information that you can find in possible
CDOSavepoints.

If you need the change information while change is happening you can
register a CDOTransactionHandler and inspect the new objects or change
deltas.

> e.g. to get added, modified and deleted objects since the last save
> within the session?
Just to get the terminology right, objects do not exist in CDOSession,
but rather in CDOViews/CDOTransactions.

> If I e.g. do a consistency check for a unique name I can successfully
> send an SQL query to the database using CDOView createQuery (CDO v.3).
> The result does, however, not include any newly created (or deleted)
> objects not yet saved to the database.
Yes, the query framework does not merge dirty state into the query
results. Maybe a cooperation with the new EMF Query will address this
complex challenge.

> This is of course not surprising and an expected behaviour, but I am
> looking for a way to also iterate through the "delta"(?) in order to
> include objects not yet persisted and exclude deleted ones.
See above.

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] Getting locally created, modified and/or deleted objects from a CDOResource or a CDOView? [message #508534 is a reply to message #508527] Tue, 19 January 2010 10:43 Go to previous message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 19
Registered: July 2009
Location: Switzerland
Junior Member
Hello Eike,

Thank you for the quick and accurate reply. I found the change datas I need in the CDOTransaction using the methods
transaction.getDetachedObjects()
transaction.getDirtyObjects();
transaction.getNewObjects()

Cheers
Bjoern
Previous Topic:emf.ecore2Java and templatepath
Next Topic:Delete Model from an resource
Goto Forum:
  


Current Time: Fri Apr 26 03:57:52 GMT 2024

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

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

Back to the top