aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes ResourceLocal to JTA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ResourceLocal to JTA" Watch "ResourceLocal to JTA" New topic
Author

ResourceLocal to JTA

baxhuli pema
Greenhorn

Joined: Nov 09, 2012
Posts: 11
I am developing an web application and I have to use JTA which I never used. I started using EntityManager but it seems not to work here. When I use EntityManager I get this message:



To cut it short, I have this piece of code:

How can I do this without EntityManager?
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1031
    
    5

I assume you have a persistence.xml file on your classpath? This is where you define the transaction type.


http://docs.oracle.com/javaee/5/tutorial/doc/bnbqw.html
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

The example of persistence.xml:



SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Mahendr Shinde
Ranch Hand

Joined: Sep 03, 2011
Posts: 38

Hi baxhuli ,
Are you trying JPA inside a simple web application? In case you are trying to run it web application or java project, you must be using "Resource_local". Which means @PersistenceContext annotation might not work!
An EJB Application provides JTA resource and annotation to inject EntityManager.


There is still lot to learn!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResourceLocal to JTA