-->
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.  [ 4 posts ] 
Author Message
 Post subject: long lived state management in web apps without db commits
PostPosted: Fri May 13, 2005 1:50 am 
Newbie

Joined: Fri May 13, 2005 1:34 am
Posts: 1
Hi I would like some advice on how to solution a problem with Hibernate on the EJB business tier. We are running WLS at the moment with Stateless Session EJBs. DVOs/DTOs are used to send data between the web and business tier and vice versa.

Existing Situation:

So far in our J2EE apps data is saved/committed to the database on a page per page basis. As such we are dealing with short lived transactions usually per HTTP post. This way whatever data has been changed (or new data) will be saved to the database and we don't have to worry about maintaining state in memory i.e. we can simply read from the database again to get the updated data.

New Scenario:

Since the majority of our users are accustomed to client server multi page "save when they are ready" type scenario it has been stated we should have our web apps mirror this process. Therefore in the new scenario the web user should be able to jump between web pages without any commits to the database for any updated/new data records. At any stage they are able to hit "Save" and all the previous work across HTTP requests will be saved. As a result we need to store the state of any modified data across HTTP requests without storing it in the database.

At the moment our application design/architecture is not suited to this new scenario since it's pretty much stateless. Moving to a more stateful scenario will require changes. The new application this will be applied to is a Client Management System (create/update Client information - contacts, addresses, relations etc).

Our theory to make this work include:

- Stateful Session Beans
- Hibernate session interface as an instance variable in a Stateful Session Bean (hibernate Session remains open yet disconnected - JDBC connections come and go)
- A Client (Hibernate POJO) instance variable in the Stateful Session Bean (walk the Client object graph on insert/update, use the uncommitted Client object graph for holding state between HTTP requests)
- DVO/DTOs going back and forth between tiers used to update the state of our Stateful Session Bean's Client (Hibernate POJO) instance variable in the Stateful Session Bean between database commits

NB this is something we have theorised - yet to proved.

A couple of questions:

i) Does anyone have any good advice in general for implementing these long lived transactions/maintaining state outside the database across HTTP requests?

ii) do you think our theory would work?

Thanks in advance.
J


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 4:37 am 
Regular
Regular

Joined: Mon Jun 13, 2005 12:21 pm
Posts: 61
Location: Hannover
Hi iasonas,

I would be interested, if you have any experience with your solution yet? Which way did you choose for your implementation?

Joerg


Top
 Profile  
 
 Post subject: Re: long lived state management in web apps without db commi
PostPosted: Wed Aug 31, 2005 6:19 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
iasonas wrote:

A couple of questions:

i) Does anyone have any good advice in general for implementing these long lived transactions/maintaining state outside the database across HTTP requests?

ii) do you think our theory would work?

Thanks in advance.
J


You do not need to change "EJB business tier" to implement this stuff, store this state in hidden form fields. It works without problems since CGI era.


Top
 Profile  
 
 Post subject: Session management
PostPosted: Wed Aug 31, 2005 6:21 am 
Beginner
Beginner

Joined: Tue Jul 19, 2005 4:03 am
Posts: 34
Location: Aberdeen, UK
Hi,

My first take on the new scenario would be to leave the Session Beans stateless, but use the user session on the web tier to temporally store the data to the session. The session is already created when a user connects to the page, and you can use this to store the DVO’s.

When the user saves the, the system will get all the DVO’s from the session and pass them onto the Stateless Session Bean which will save the data using Hibernate. This option makes sense since you are not making multiple Remote Calls to the EJB.

We are using Struts to implement out Web Tier using the approach I explained above, and it works just fine!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

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.