-->
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: injecting values into objects created by a query
PostPosted: Wed Aug 20, 2008 11:29 pm 
Regular
Regular

Joined: Wed Sep 10, 2003 2:26 pm
Posts: 56
Location: San Diego, CA
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.


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.