Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] transaction handling question

You have your transaction-type set to JTA, so you must use JTA for your
transactions, not the EntityManager local transactions.

>> <persistence-unit name="cpsjpa" transaction-type="JTA"> 

If you want to use local EntityManager transaction, you must set your
transaction-type to RESOURCE_LOCAL.



khaskett wrote:
> 
> New to JPA and having trouble getting it working correctly.  
> 
> I am running on WAS 6.1 with a DB2 datasource defined.  In my
> persistence.xml I have a <jta-data-source> pointing to that jndi
> datasource.
> 	<persistence-unit name="cpsjpa" transaction-type="JTA">
> 		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
> 		<jta-data-source>jdbc/DB2DS</jta-data-source>
> 
> In my persistence.xml I had some conflicting entries referring to openjpa
> properties.  I have just removed them and now I just have these -
>             <property name="eclipselink.target-server"
> value="WebSphere_6_1"/>
>             <property name="eclipselink.target-database" value="DB2"/>
> 
> The thing that is confusing is that before I took these out I was able to
> do this in my code -
>                 entityManager.getTransaction().begin();
>                 entityObject =
> this.cpTransactionManager.update(entityObject);
>                 entityManager.getTransaction().commit();
> 
> Now since taking those openjpa entries, I get transaciton errors -
> Exception Description: Cannot use an EntityTransaction while using JTA.
> 	at
> org.eclipse.persistence.internal.jpa.transaction.JTATransactionWrapper.getTransaction(JTATransactionWrapper.java:65)
> 	at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.getTransaction(EntityManagerImpl.java:863)
> 
> Is there something I am missing here?
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/transaction-handling-question-tp22605871p22662495.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top