[jboss-user] [EJB/JBoss] - EJB : Maintaining a context for each stateful session bean w

olvin do-not-reply at jboss.com
Mon Jan 29 11:26:45 EST 2007


Our app.ear will be used by more than one database (so, there are more than one persistence unit).

So, we have a MAIN stateful session bean which receipts queries from clients to execute some procedures.
The procedures are stored in others stateless session beans or simple java classes.
We have recorded all the persistence units in the JNDI and we pass the name of the one to use to the MAIN stateful session bean which is the remote access for the clients. No problem to access to the database through the entitymanager directly from the MAIN stateful session bean :
            InitialContext jndiContext = new InitialContext();
            em = (EntityManager) jndiContext.lookup("java:/"+persistenceUnitName);

How can we know in the stateless session beans or in the simple java classes the persistence unit to use without propagating the name of the persistence unit to use to all the methods ?
=> A kind of a "context" for each MAIN stateful session bean instances which will be accessible for all beans and classes called from the instances.
But how to implement it ?



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

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

More information about the jboss-user mailing list