I'm trying for what I guess I'd call

session-per-request-but-keep-the-session-in-the-ejb-layer.

So - a request comes in (servlet). That creates a service object (business layer stub) 
which will call the business logic in the session beans.

To avoid session-per-operation (which was the code I inherited) I thought - OK - let's 
move the session into the state of the bean.

So logic should be:


  | bean = home.create();
  | 
  | bean.method1(); // Calls getSession - Session created
  | 
  | bean.method2(); // Calls getSession - returns stored session
  | 
  | bean.remove(); // Session removed.
  | 

Note - you need to nullify the session at passivate (or at least I think you do) - so 
the getSession method was created - to create a session if one didn't exist from 
before or if passivate had been called. This would look like


  | bean = home.create();
  | 
  | bean.method1(); // Calls getSession - Session created
  | 
  | Bean passivated - session closed
  | 
  | bean.method2(); // Calls getSession - Session created
  | 
  | bean.remove(); // Session removed.
  | 

The problem is that when method1 exits - then I get the
2004-10-05 23:36:09,053 INFO  
[org.jboss.resource.Connectionmanager.CachedConnectionManager] Closing a connection 
for you.  Please close them yourself: [EMAIL PROTECTED]
  | java.lang.Exception: STACKTRACE

error - even though the session is stored in an active stateful session beans session.

NB - this is a gradual process - moving now from session per operation to session per 
bean per request - will move to session per request if I can figure out how to share 
the session between bean instances without returning it over RMI from the EJB 
container.

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3850851#3850851

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3850851


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to