4 Replies Latest reply on Oct 23, 2008 5:44 PM by Guillaume Jeudy

    Reuse stateless services built with Seam

    Guillaume Jeudy Master


      I'm using Seam 2.0.1.GA and I would like to know if I can reuse my stateless service layer for remote EJB calls issued by other applications.

      I'm using SMPC so the EntityManager gets injected through @In annotation. I realize that if I access my stateless EJB through traditional JNDI lookup the EntityManager will not get injected.

      Has anyone found a solution where I can still get the EntityManager injected? I guess I would need somehow to pass through Seam context to get hold of my stateless EJB.

      Another alternative I guess is to inject both

      public class MyStatelessServiceImpl implements MyLocalInterface, MyRemoteInterface {
      EntityManager em;
      EntityManager em2;

      and use @In EntityManager if populated otherwise fallback to @PersistenceContext injected one. This workaround appears a little messy though..