JBoss Community

Re: @PersistenceContext is null in jboss7

created by yunshi tan in JBoss AS 7 Development - View the full discussion

Thanks Wolf-Dieter et Nicklas,

 

Finally find out the probleme. It has nothing to do with Ejb, neither Hibernate, but classloading I think.

 

My probleme is

 

I have a parent DAO  which was placed in a module

 

public abstract class ParentDAO{

 

   @PersistenceContext

   private EntityManager em;

 

   // some basic functions...

 

}

 

Then other DAO extends the parent DAO and they are placed in deployment

 

@Stateless

public class DAO extends ParentDAO implements LocalDAO, RemoteDAO{

 

   // other dao functions using em from parentDAO...

 

}

 

After I move the ParentDAO project out to deployment from the module, it works.

 

I cannot really figurer out why but I think its the classloading probleme.

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community