3 Replies Latest reply on Oct 25, 2012 1:41 PM by User696-Oracle

    How to instantiate an EJB class in a non-EJB class?


      I am using Maven framework to build my project and EJB 3.0 is the EJB specification. I have an EJB interface A and its corresponding EJB class B that implements A. The body of class B is shown below:

      +@TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW)+
      +class B implements A{+

      +@PersistenceContext(unitName = "Draco-PU", type = PersistenceContextType.TRANSACTION)+
      EntityManager entityManager;

      +//called post construct+
      +public init(){+

      +//body of init method+


      I have a non-EJB class in a different package under the same project. I want to instantiate class B in this class, so that the init() method and other annotations are automatically referred and I can give explicit call to other methods in the EJB class. How can I look up the EJB class for accessing the methods? Please help.