Martin, Thanks for the response! I was actually just modifying my implementation to store just the ID in the session and was trying to figure out where the best place to load it would be. I was trying to load it in a page constructor, but was finding that doesn't always work. So I'll explore using the requestcycle for this, as you suggest. Any hints or examples you could share?
Thanks, Tauren On Thu, Feb 19, 2009 at 11:03 PM, Martijn Dashorst <[email protected]> wrote: > Access to session is not thread safe: resources, and request > setup/teardown will give you headaches (ever tried to attach one > entity instance to two hibernate sessions?). We store the ID of the > entity in the session, and load it in the requestcycle (and get the > instance from there). > > Martijn > > On Fri, Feb 20, 2009 at 3:20 AM, Tauren Mills <[email protected]> wrote: >> The WIA book and other example apps I've found online often show a >> User object being stored in the session: >> >> class BlogSession extends WebSession { >> private User user; >> } >> >> But does it make sense to do this if your User object is loaded from a >> persistence layer (Hibernate) and can contain a large tree of >> dependent objects? For instance, what if my User object has a >> hierarchy like this: >> >> User >> Name >> Password >> Set<Blog> >> Blog >> Set<BlogEntry> >> BlogEntry >> Set<Tag> >> Set<Tag> >> >> Would this store the entire hierarchy of blogs, tags, blog entries, >> etc. into the session? I've been experimenting with storing an LDM >> of the user in the session instead of the User directly: >> >> class BlogSession extends WebSession { >> private DetachableUserModel userModel; >> } >> >> But I'm getting Hibernate LazyInit errors. So it leaves me wondering >> if LDMs in Session aren't automatically loaded since it isn't a >> Component. I haven't really dug into what is going on yet. I first >> wanted to find out what is common practice for a situation like this. >> >> Oh, and this isn't my actual User object -- just and example for >> illustrative purposes. I'm not building a blog, and the properties >> and sets of objects in my User need to be there. >> >> Thanks! >> Tauren >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > > -- > Become a Wicket expert, learn from the best: http://wicketinaction.com > Apache Wicket 1.3.5 is released > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
