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.