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
