[jboss-dev-forums] [JBoss AS 7 Development] - Re: @PersistenceContext is null in jboss7

yunshi tan do-not-reply at jboss.com
Mon Sep 17 04:39:57 EDT 2012


yunshi tan [https://community.jboss.org/people/yunshi] created the discussion

"Re: @PersistenceContext is null in jboss7"

To view the discussion, visit: https://community.jboss.org/message/759828#759828

--------------------------------------------------------------
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
[https://community.jboss.org/message/759828#759828]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120917/e41904f5/attachment.html 


More information about the jboss-dev-forums mailing list