Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
JSP - A mailing list about Java Server Pages specification and reference
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Modelling a Session: Tradeoffs

Modelling a Session: Tradeoffs

2004-04-05       - By Stefan Frank

 Back
Reply:     1     2     3  

Hi,

we are currently in the process of migrating a perl-based legacy
application to j2ee and I'm currently building up the model for some
parts of the System: I'm especially re-evaluating the approach to model
the design for storing session-based Information:

The System consists of Projects, that contain DataSets, that contain
Experiments.

The Requirement is to have a Session that stores the currently active
Project, the last opened DataSet and the current Experiment, along with
various other parameters about the current setup of experiments.

The Legacy-App(a perl-based Webapplication) simply stored all this
values in the Database&retrieved them with every call.

When we move this to a J2EE-Enviroment, inside the session you basically
get Properties (either flat, or - if it gets more complex -
hierarchically grouped): As values for the Properties you can either
have simple Properties, POJO's or handles on EJB's.

So here are my questions:

a) Modelling this as a Stateful SessionBean is the obvious choice(or do
you disagree?). A less obvious question is how to persist this Session:
The approach of the legacy-app was to put everything that can be stored
in the Session, into the DataBase. As it can easily change, what kind of
Data can be stored in the Session, you have come up with some generic
mechanism to save the Properties from the Session inside the DB - and
thereby restrict yourself on types that can easily be persisted (eg.
Strings, int, long, etc.), and persist the state manually when the
Stateful-Session is destroyed OR - which is my question: Every major
Application-Server-vendor persists the "State" of a Stateful session
anway: Why not just rely on that, have the Application-Server persist
the state and restore it. Has anybody used a Stateful-Session-Bean&the
App-servers serialize/deserialize-Mechanisms for long-term Storage of
Session-State??!

b) We are using hibernate as persistence-framework: The Reason for this
was the lack of Flexibility of Entity-Beans. This results in an obvious
choice on the Object you want to store inside the Session: If you want
to store the last openend Project in the Session, you just take the POJO
and store it. Alas, this has some obvious drawbacks: The Object may get
stale, deleted in the meantime, changed etc. - so instead of storing the
Object inside the Session, you have to store a handle to the Object. I
actually thought about switching back to EntityBeans, as this seems to
be the Design-Rationale, that once led to this "heavy" design. So,
instead of storing the real, persistent Object inside the Session, one
has to construct a handle, and a means to reconstruct the Object from
this handle (which in hibernate's case is just the class-name and a
primary-key). Then again, I end up with the question: Can I simply have
the App-Server persist this handle or should I write something on my own?!

Has anyone experiences with that?! And knows how the different
approaches scale (both in terms of performance and development-time)?

thx in advance
stf

====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.