Hi,

I'm currently trying to migrate from Jboss 4.0.4RC1 to 4.0.4 GA, and I have 
some problems with EJB3 stuffs migration.
I followed the migration wiki pages, but i still have a problem when using 
EntityManager from stateless beans ; it seems that the persistence context is 
not found correctly.
Here's my application structure:
entities.jar includes entitities POJO + persistence.xml
sessions.jar includes stateless EJB

Both files are packaged in a ear file.

in my stateless bean i have:


  | @PersistenceContext(unitName="escapeKRepository")
  | protected static EntityManager em;
  | 

where escapeKRepository is the name of the persistence-unit. All this was 
working well with 4.0.4RC1, but now I get :


  | Caused by: javax.persistence.TransactionRequiredException: EntityManager 
must be access within a transaction
  |     at 
org.jboss.ejb3.entity.ManagedEntityManagerFactory.verifyInTx(ManagedEntityManagerFactory.java:149)
  |     at 
org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:174)
  | 

when i first call a bean method.
I read on the wiki pages that there was a special syntax to use in 
PersistenContext when persistence is not in the same jar, but i don't know how 
to do it ...
To be sure, i tried to create a new jar file containing all my classes (POJO + 
EJB) and the persistence.xml : this worked fine !!

So , how should i write the @PersistenceContext ?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3953078#3953078

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3953078

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to