Feb 24th, 2006, 01:04 PM
Interceptor for performing lazy loads
I'm using Spring with iBatis. The iBatis layer is performing the OR mapping in the SQL Maps and retrieving the data from the database. When I perform a query I get back instances of my Pojo's. What I would like to do is write an interceptor to perform the lazy loads of other referenced objects. The reason I want to do this is that some object are retrieved from one data source and other objects from a different data source. (Two databases) There is no way to accomplish this in iBatis so what I thought would be a good idea was to write an interceptor for my Pojo classes that support this relationship and only fetch the data when needed.
Seeing as iBatis is instanciating the Pojo's on its own, not going through the Spring factory methods, the interceptor that I wrote and placed on the Pojo's does not get invoked because Spring is not managing the objects.
Is there any way to get around this like having the iBatis layer use the Spring factory methods to retrieve the Pojo's? or a different way of having the Pojo's intercepted?
Thanks for the help...