From: Ara A. <ar...@ya...> - 2002-12-22 18:30:24
|
Btw while we're talking about eager loading or lazy loading things... how do you find the idea of providing a dynamic mechanism to specify at runtime for each scenario which parts should be loaded eagerly or lazily? I mean a simple LoadPolicy object passed to the session.load() method. Specifying lazy-load/blabla in the xml file is a very static and inflexible approach for different use cases. Ara. > -----Original Message----- > From: hib...@li... [mailto:hibernate-devel- > ad...@li...] On Behalf Of Christian Bauer > Sent: Sunday, December 22, 2002 3:46 AM > To: hib...@li... > Subject: Re: [Hibernate] Road Map > > On 22 Dec (10:44), Gavin King wrote: > > > I agree with this. It is the resposibility of the middle tier > > to fetch data. If it did not fulfil its part of the contract, > > we can't just have the web tier suddenly open connections to > > the database. That has all *kinds* of security implications. > > > > > I can't see any other decent way - the View layer should not > > > just assume it got the whole object model available to it... > > BTW, using a ThreadLocal is OK in a three tier setup, thanks Gavin for > the pointer. > > I'm not talking about opening "direct connections" to the database, but > I think we all agree, that if the View gets an Object from the Business > Facade, all properties of this object should be visible and available to > the View. They wouldn't be if the Hibernate Session is closed and lazy > collections are not initialized. Initializing the Collections in the > Business Layer would either mean: > > a) Initializing all lazy loaded Collections in the Business Layer or DAO > with Hibernate.initialize() and serve them with their objects in the > usual methods, e.g. "getEmployerByOID()" would return the requested > Employer and all of its Employees already initialized, everytime. > Somehow, Lazy Loading doesn't make any sense at all. > > b) Only load the lazy Collections when either a switch is triggered in > the Business Facade method "getEmployerByOID(boolean initAll)" or > another special method is called "getEmployerByOIDInitAll()". > > Is there a c)? > > I'm happy now with the ThreadLocal and a cleanup process at the end of > the requeast and just assume, that when I get an Employer from my > Business Facade, I can access all its properties. > > Custom Data Transfer Objects and Data Transfer Maps would somehat remedy > this problem, but I don't like these patterns when using POJOs instead > of Entity Beans. > > -- > Christian Bauer > tu...@in... > > > ------------------------------------------------------- > This SF.NET email is sponsored by: Order your Holiday Geek Presents Now! > Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap, > MP3 Players, XBox Games, Flying Saucers, WebCams, Smart Putty. > T H I N K G E E K . C O M http://www.thinkgeek.com/sf/ > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |