I have a stateless session bean with a method that creates a query using the 
entity manager. Since the method is read-only I don't want to force a new 
transaction so I use the attribute type SUPPORTS. I can't get that to work. I 
always get the following stack trace:

javax.persistence.TransactionRequiredException: EntityManager must be access 
within a transaction
        at 
org.jboss.ejb3.entity.ManagedEntityManagerFactory.getSession(ManagedEntityManagerFactory.java:124)
        at 
org.jboss.ejb3.entity.InjectedEntityManager.getSession(InjectedEntityManager.java:154)
        at 
org.jboss.ejb3.entity.InjectedEntityManager.createQuery(InjectedEntityManager.java:67)
...

Why is that? Do I always have to have a transaction? Even if the operation is 
just read-only?

TIA
Thomas Hallgren


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

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


-------------------------------------------------------
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