hi all, 
i'm new in ejb, and i have a problem :

in a class where i implement interface Schedulable.... in the perform() method 
i write this code :
UserTransaction ut = (UserTransaction)initCtx.lookup("UserTransaction"); 
ut.begin(); 
emi.persist(new RssItemBean());
ut.commit();

i got emi like this : 
EntityManagerFactory 
emf=Persistence.createEntityManagerFactory("em");emi=emf.getEntityManager();

and i get this exception :
 javax.persistence.TransactionRequiredException: no transaction is in progress
     at 
org.hibernate.ejb.AbstractEntityManagerImpl.checkTransactionActive(AbstractEntityManagerImpl.java:123)
     at 
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:128)
     at 
services.schedulables.SchedulesForRssWorker.run(SchedulesForRssWorker.java:221)

and i know that this exception is thrown because i use the emi outside an 
persistence context but how can i get the persistence context ?

thanks,
chelaru.viorel

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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to