0 Replies Latest reply on Mar 15, 2013 9:37 AM by bsonrisa

    Are EJB3 session bean calls always in the same thread?

    bsonrisa

      Suppose you have a class like this:

       

       

      public class MyEJB {
      
           @EJB
           public OtherEJBLocal other;
      
           public void callSomething() {
                other.callAnotherMethod();
           }
      }
      

       

      Will the method call on the second EJB necessarily run in the same thread as the initial call to MyEJB.callSomething() ? What if the second EJB is a singleton?

       

      I'm asking because I want to use thread-local Hibernate sessions (using sessionFactory.getCurrentSession() ). For various legacy-code reasons, we cannot use JTA transations or CMT.