Conversational State in EJB and HTTPSessions (Core J2EE Patterns)

Hi all,

I've read the book (Core J2EE Patterns) mentioned in this forum... and it's really great!!

But i have a question about a - from my point of view - important topic when developing web-application.

Where and how to store EJB-References?

Perhaps i have not read the book carefully enough... but is there a topic which points this out very clear?

Given this example...

I have a web-front-end for a - let's say - registration-workflow.

There are n screens where the users types in information. At the end all data where stored in a database.

One design could be the use of the Controler-Dispatcher-Pattern with some help of Business-Delegates and

Service-Locator in the web-container. In the EJB-Part i can use a Session-Facade which coordinate the

Entity-Beans...

My question now is where - if so - to store the reference of the statefull-session-bean when the

environment of the ejb-client is stateless (ex. http)? I've seen examples where the references where stored

in the http-session. Is this the "preferred" place? What are the consequences (Object must be serializable...)

in a cluster-environment? What about the handles?

In my last project i've implemented this as described (stored in http-session)...

Can anybody share the same experience or has additional comments?

Thanks

Sandro

[1426 byte] By [sanruch] at [2007-9-26 5:48:03]
# 1
Hi Sandro,i can't help you because i'm facing the same problem...Where should i store values coming from different screens ? Everything in the session object? Or everything in ejb? If you have an answer you are welcome !!
javamad at 2007-7-1 14:12:17 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

Hi Sandro,

In a clustured environment if a statefull session bean is created in a particular server the next request will come to that server only. This is ensured by the application server. Hence keeping the handle of the stateful session bean in the session object is not an issue at all in the clustured environment.

Hope this clarifies your doubt.

Regards,

Sourav

souravm00 at 2007-7-1 14:12:17 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
Is EJBHomeFactory is the solution for this...?
milijava at 2007-7-1 14:12:17 > top of Java-index,Other Topics,Patterns & OO Design...