-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Tracking changes on shared collections?
PostPosted: Thu Nov 06, 2008 3:14 am 
Newbie

Joined: Thu Dec 21, 2006 7:30 am
Posts: 11
Hi -

I am creating a system which uses push technology (publish - subscribe) using hibernate for ORM. Everything so far is good.

Using interceptors if can track changes on simple objects, but I have trouble tracking changes on both owners on shared collection.

Consider the following scenario:

Two classes A and B which are n-m-mapped:
Code:
public class A
{
   private Set<B> bs;
   public Set<B> getBs() { return bs; }
}

and
Code:
public class B
{
   private Set<A> as;
   public Set<A> getAs() { return as; }
}


Now in some transaction an instance of B is added to an instance of As set of Bs:
Code:
transaction.begin();
A a = session.load(A.class, a_id);
B b = session.load(B.class, b_id);
a.getBs().add(b);
transaction.commit();


Finding out that a has changed is easy using an interceptor, but how do I find out that b has changed as well?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.