ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: Reload Lazy Objects
Date Wed, 29 Jun 2005 16:55:12 GMT
Could you just have your user object delegate the retrieval of the
list to the service object (instead of storing it internally) and rely
on caching instead of lazy loading?

If an update occurs, the cache gets flushed, and the next call to get
the list gets fresh data.


On 6/29/05, Mike Fotiou <Mike.Fotiou@pwgsc.gc.ca> wrote:
> Is there any way in IBATIS to mark an object that was lazy-loaded as
> "unloaded" so that the object will be reloaded again?  I'm thinking about
> the following scenario: 
> Domain Objects:  
> User contains Role objects (a List) 
> Sevice Object: 
> UserService.removeUserRole(User u, String roleCode); 
> DAO Object: 
> UserDAO.removeUserRole().... 
> The service object now has to manage the User object's List of roles. 
> Ideally, this List would be immutable, but otherwise the service object has
> to iterate through the List and remove the appropriate Role object.  I could
> add a removeRole() method on the User object, but that is a little
> confusing, as there is a removeUserRole on the ServiceObject.  I do not want
> to allow the domain objects access to the DAO layer, that's the reason for
> the service layer.  I'm considering scrapping the service layer altogether
> in favour of heavy-weight domain objects that can manage their own
> collections easily. 
> Any ideas?

View raw message