[CDO] Finding detached objects [message #905327] |
Thu, 30 August 2012 03:17  |
Eclipse User |
|
|
|
Hi,
I have CDO objects that are referenced from a "data structure". I want to update that structure in one batch AFTER a successful commit. The problem is to find the objects that where detached in the commit.
I have tried a few options:
CDOSessionInvalidationEvent:
Seems like the perfect fit since it gives you a CDOIDAndVersion object for every added, changed or detached object after a commit (from anywhere). Finding the actual added and changed objects is easy using view.getObject(cdoIDAndVersion.getID()). BUT how do I find the detached objects in/from the committing CDOTransaction? You can't use the same view.getObject method since detached objects are no longer present in the committing CDOTransaction.
CDOViewInvalidationEvent:
Another seemingly perfect fit. Gives you added, changed and detached object instances from the view receiving the event. BUT this event doesn't get sent to the committing transaction, only to all other views.
So, how do I use invalidation events, or some other mechanism, to get the actual instances of still referenced but removed (from a CDO perspective) objects from the committing transaction?
Regards
///Anders
|
|
|
Re: [CDO] Finding detached objects [message #905331 is a reply to message #905327] |
Thu, 30 August 2012 03:22   |
Eclipse User |
|
|
|
Hi Anders,
You can attach a CDOTransactionHandler1 to your CDOTransaction to be
notified of attached/detached/modifyed objects.
Regards.
On 30/08/2012 09:17, Anders Jönsson wrote:
> Hi,
>
> I have CDO objects that are referenced from a "data structure". I want
> to update that structure in one batch AFTER a successful commit. The
> problem is to find the objects that where detached in the commit.
>
> I have tried a few options:
>
> CDOSessionInvalidationEvent:
> Seems like the perfect fit since it gives you a CDOIDAndVersion object
> for every added, changed or detached object after a commit (from
> anywhere). Finding the actual added and changed objects is easy using
> view.getObject(cdoIDAndVersion.getID()). BUT how do I find the detached
> objects in/from the committing CDOTransaction? You can't use the same
> view.getObject method since detached objects are no longer present in
> the committing CDOTransaction.
>
> CDOViewInvalidationEvent:
> Another seemingly perfect fit. Gives you added, changed and detached
> object instances from the view receiving the event. BUT this event
> doesn't get sent to the committing transaction, only to all other views.
>
> So, how do I use invalidation events, or some other mechanism, to get
> the actual instances of still referenced but removed (from a CDO
> perspective) objects from the committing transaction?
>
> Regards
> ///Anders
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03920 seconds