-->
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: Sessio management in AJAX-based application
PostPosted: Mon Jun 13, 2005 7:57 pm 
Newbie

Joined: Wed Dec 01, 2004 12:44 am
Posts: 3
Hi everybody,

I am after a bit of architectural guidance - I have been using Hibernate for quite a while now and am familiar with most of the concepts and patterns.

I have just started a small project using NextApp's Echo2 framework, which is an AJAX-based web application framework.
The framework basically sits somewhere in between a traditional web application with a request/response cycle and a fat-client GUI application. For each user interaction (which could include selecting an entry from a list box, clicking a button, changing text in a text field, etc.), an XmlHttpRequest is issued to the application in the background, and upon response from the server, certain parts of the page displayed in the browser are updated. The main difference to a traditional webapp is that there is a single instance of the application, which is tied to the Http session. This instance contains the complete tree of GUI comopnents, which in turn are tied to the underlying model objects (which, of course, are provided through Hibernate). The main difference to a fat-client GUI app is that each interaction with the application occurs in a different thread, as with a traditional webapp.

Now, for a normal webapp, I would use the Open Session In View pattern, whereas for a GUI app I would create a single session on application startup and use explicit transaction management managing the read/write cycle of the application.

However, none of these approaches seem to work too well - I either end up with the SessionPerUserSession antipattern, or run into problems with lazy initialisation as there are many model objects stored in the Http Session. OpenSessionInView does not work as commonly described, as there are a lot more (very small) requests going back and forth.

What would be th best way to approach this problem? Is the SessionPerUserSession antipattern acceptable in this instance? Or is there a better way to manage the Hibernate session?

I have been thinking about the method described in http://www.hibernate.org/168.html (session-per-application-transaction), which may be applicable - the only problem is that I cannot clearly define the boundaries for an application transaction, as any UI element in a page may initiate a different request, so I do not have a clearly defined request cycle for an application transaction.

Any thoughts on this would be greatly appreciated.

Thanks,
Max


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.