Hello,

I'm a new user trying out OpenJPA and I've come across what seems to be a
bug:

When generating the schema for a persistence context, OpenJPA seems to use
auto-commit mode. However, the JDBC4 spec explicitly prohibits auto-commit
for XA-capable data source. Therefore, if you happen to use an XA driver, a
proper JDBC implementation would cause OpenJPA.

This is exactly what happened when I tried OpenJPA: I'm using OpenJPA 1.2.1
with Derby Embedded 10.4.2.0 (both from Geronimo 2.2 distribution).

Derby performs the check for auto-commit mode (see
http://issues.apache.org/jira/browse/DERBY-1236) and aborts. The stack trace
looks like:

Caused by: java.sql.SQLException: Cannot set AUTOCOMMIT ON when in an XA
connection.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
Source)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
Source)
        at org.apache.derby.jdbc.EmbedXAConnection.checkAutoCommit(Unknown 
Source)
        at org.apache.derby.iapi.jdbc.BrokeredConnection.setAutoCommit(Unknown
Source)
        at
org.tranql.connector.jdbc.ManagedXAConnection.localTransactionCommit(ManagedXAConnection.java:104)
        at
org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
        at
org.tranql.connector.jdbc.ConnectionHandle.setAutoCommit(ConnectionHandle.java:160)
        at
org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:198)
        at
org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1175)
        at
org.apache.openjpa.jdbc.schema.SchemaTool.createTable(SchemaTool.java:949)
        at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:526)
        at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
        at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
        at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
        ... 69 more
Caused by: java.sql.SQLException: Cannot set AUTOCOMMIT ON when in an XA
connection.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
        at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
Source)
        ... 85 more

Is this indeed a bug?

-- 
View this message in context: 
http://n2.nabble.com/Schema-generation-uses-auto-commit-mode-breaks-on-XA-data-sources-tp4583095p4583095.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to