Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » DML without transaction
DML without transaction [message #1059035] Thu, 16 May 2013 11:10 Go to next message
Daniel Elstner is currently offline Daniel Elstner
Messages: 3
Registered: May 2013
Junior Member
Hi,

I try to set up a DML statement on our persistence unit.
The persistence unit throws an exception:
javax.persistence.TransactionRequiredException:
Exception Description: No transaction is currently active

The problem is, that the database behind the persistence unit
does not support transactions. If i start a transaction and
commit/rollback it, even with a select statement, nothing happens.

I wonder if there is a way to work around this.

Database we use is an old informix database.

Kind regards and thanks in advance,
Daniel
Re: DML without transaction [message #1060024 is a reply to message #1059035] Wed, 22 May 2013 14:55 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Does you database throw an error if you try to start a transaction, or just not support rollback?

James : Wiki : Book : Blog : Twitter
Re: DML without transaction [message #1060582 is a reply to message #1059035] Mon, 27 May 2013 07:35 Go to previous messageGo to next message
Daniel Elstner is currently offline Daniel Elstner
Messages: 3
Registered: May 2013
Junior Member
It throws an error...

Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.0.1 (Build 20080905)): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Transactions not supported
Error Code: -79744


Rollback is not needed. Without transaction I can execute select statements
but I can't execute DML.

If i try to execute DML without transaction it throws the following exception:
javax.persistence.TransactionRequiredException: 
Exception Description: No transaction is currently active
Re: DML without transaction [message #1060815 is a reply to message #1060582] Tue, 28 May 2013 13:47 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can prevent EclipseLink from starting a database transaction using a SessionCustomizer

session.getLogin().setUsesExternalTransactionController(true);


James : Wiki : Book : Blog : Twitter
Re: DML without transaction [message #1060914 is a reply to message #1060815] Wed, 29 May 2013 07:02 Go to previous message
Daniel Elstner is currently offline Daniel Elstner
Messages: 3
Registered: May 2013
Junior Member
James Sutherland wrote on Tue, 28 May 2013 09:47
You can prevent EclipseLink from starting a database transaction using a SessionCustomizer

session.getLogin().setUsesExternalTransactionController(true);


Just tested, works great thank you for your help.
Previous Topic:Trying to Marshall/Unmarshall xjc generated classes that don't have a @XmlRootElement annotation
Next Topic:Cannot find jpa.osgi plugin in Eclipselink 2.5.0
Goto Forum:
  


Current Time: Wed Sep 17 13:44:13 GMT 2014

Powered by FUDForum. Page generated in 0.03562 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software