Hi,
I have two classes in a simple composition relationship:
class A {
private B child;
}
class B {
private Policy policy;
}
At some point, I'm using Spring's Hibernate template to retrieve all entities of type A:
hibernateTemplate.find("from A");
This query will return a list of instances of type A, each also having a lazy association to an object of type B.
At some point after this query, but before someone gets to use objects returned by the query, I need to make sure that every object B is injected with an instance of Policy object.
I've tried setting an interceptor:
hibernateTemplate.setEntityInterceptor(new Interceptor() {...});
but it's not getting triggered (I'm assuming I'm not using interceptors properly).
Any suggestions on how to handle this?
Thanks
D.
|