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?