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: On-demand initialization using proxies in multi-tier apps?
PostPosted: Tue Mar 22, 2005 10:29 am 
Newbie

Joined: Mon Oct 27, 2003 10:03 am
Posts: 15
The problem of using Hibernate - or any ORM tool using lazy initialization for that matter - in a multi-tier architecture which physically separates the persistence tier from the presentation tier seems to be an inexhaustible well of debate.

In Hibernate's Wiki, Steve Ebersole describes a solution using DTOs specifically tuned to the needs of the application at hand. As a potential drawback he mentions the extra work needed to code these DTOs. Moreover, one might argue that DTOs in general exhibit Martin Fowler's code smell of parallel class hierarchies as described in Hibernate in Action, though this might be a matter of personal taste. Mind you, I don't say that this solution is bad. Trying to balance simplicity and performance is always a hard task which - in my view - demands a compromise to be made.

The Wiki also links to a post in which the author described a solution based on CGLIB proxies which initialize collection properties on demand, caching the results. At first glance, I find this solution attractive yet a quick survey on the internet revealed that it seems to be rarely used, if at all. Moreover, its imlementation seems to be problematic, since people who embarked on this road often struggle with ObjectNotUniqueExceptions, if I recall correctly.

So before I go about implementing this approach myself - I have never worked with dynamic proxies - I would like to know if there is anybody out there who has taken this road and would be willing to share his experiences. Is it a viable solution? If yes, what are the problems to look out for? Of course, code samples would be great ;-) Just dreaming ...

Many thanks for any pointers,

Olaf Bergner


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.