That would solve the problem, but seems to tie the application to
servlets.  Are there any other recommended methods which allows the
application to remain extendable, perhaps so that a web services layer
could be added in the future (a web services layer is a potential future
requirement)?

--Chris

On Mon, 2003-02-10 at 21:05, [EMAIL PROTECTED] wrote:
> 
> Check out the "open session in view" pattern for these kind of simple
> applications.
> 
> The basic idea is to use a servlet filter to open and close sessions.
> 
> 
> 
>                                                                                      
>                                                  
>                     Chris Conrad                                                     
>                                                  
>                     <[EMAIL PROTECTED]>                To:     [EMAIL PROTECTED]     
>                         
>                     Sent by:                                cc:                      
>                                                  
>                     [EMAIL PROTECTED]       Subject:     [Hibernate] Hibernate usage 
> question                         
>                     eforge.net                                                       
>                                                  
>                                                                                      
>                                                  
>                                                                                      
>                                                  
>                     11/02/03 11:54 AM                                                
>                                                  
>                                                                                      
>                                                  
>                                                                                      
>                                                  
> 
> 
> 
> 
> After reading the Hibernate documentation and contributed documentation,
> I have not seen any advice on how to best utilize Hibernate for this
> application.
> 
> I'm currently working on a community based collaboration web
> application.  The architecture is fairly basic, an MVC framework
> (probably Struts) for the web tier, local stateless session beans for
> the business tier and hibernate for the persistence layer.  The problem
> I've run across is this application has many entities which are
> inter-related in a potentially large object graph.  For example, a User
> is associated with 1 or more Communities.  Each Community is associated
> with 1 or more Conversations.  Each Conversation can have any number of
> Threads, etc.
> 
> My question is, what is the best way to manage a large object graph like
> this?  The first thought I had was to use lazy loading and proxies, but
> since the session is already closed by the time the data gets to the web
> tier, that doesn't work.  The Lightweight Class pattern seems to
> partially solve the problem but leaves two issues unresolved:
> 
> 1. It will require a large number of Lightweight Classes to avoid
> retrieving unnecessary data from the database.  For example, the basic
> user information will be stored in the HttpSession.  To get the
> Communities related to it, an object mapped just to the user's
> Communities relationship will be necessary.  To get the Tasks assigned
> to them, an object mapped just to the users Tasks relationship will be
> necessary.  Using a heavy weight class with proxies and lazy loading
> allows for only 1 object to be used, but then all of the data already
> stored in the user's session will be fetched as well, adding an extra
> query (1 query for the data I already have, 1 query to lazy load the
> data I actually want).
> 
> 2. There doesn't appear to be any way to manage creating new
> relationships without at least 1 extra query.  If I want to add a
> Conversation to a Community, I'll need to load the Community (at least 1
> query, 2 if using lazy loading) and then add the Conversation to the
> Community (a second query to update the join table).
> 
> Unfortunately, I've been unable to find any documentation or examples
> that deal with a large object graph but are unable to use lazy loading
> and proxies because of the EJB layer.  I'd be very grateful for any
> pointers to docs or examples that solve this problem.  I'm sure I'm
> going about it from the complete wrong direction which is why I'm
> running into this issue in the first place.
> 
> --Chris
> 
> 
> 
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
> 
> 
> 
> 
> **********************************************************************
> Any personal or sensitive information contained in this email and
> attachments must be handled in accordance with the Victorian Information
> Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988
> (Commonwealth), as applicable.
> 
> This email, including all attachments, is confidential.  If you are not the
> intended recipient, you must not disclose, distribute, copy or use the
> information contained in this email or attachments.  Any confidentiality or
> privilege is not waived or lost because this email has been sent to you in
> error.  If you have received it in error, please let us know by reply
> email, delete it from your system and destroy any copies.
> **********************************************************************
> 
> 
> 




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Reply via email to