Resolve NullPointerException on JtaTransacionManager

This commit is contained in:
Leone Parise
2015-06-30 01:01:35 -03:00
parent 49babef495
commit 5c4ad4c01c
@@ -115,7 +115,7 @@ public class JdbcTransaction implements SpiTransaction {
/**
* Set to true if the connection has autoCommit=true initially.
*/
protected final boolean autoCommit;
protected boolean autoCommit;
protected IdentityHashMap<Object, Object> persistingBeans;
@@ -146,11 +146,13 @@ public class JdbcTransaction implements SpiTransaction {
this.batchOnCascadeMode = manager == null ? PersistBatch.NONE : manager.getPersistBatchOnCascade();
this.onQueryOnly = manager == null ? OnQueryOnly.ROLLBACK : manager.getOnQueryOnly();
this.persistenceContext = new DefaultPersistenceContext();
this.autoCommit = connection.getAutoCommit();
if (this.autoCommit) {
connection.setAutoCommit(false);
if (connection != null) {
this.autoCommit = connection.getAutoCommit();
if (this.autoCommit) {
connection.setAutoCommit(false);
}
}
} catch (Exception e) {
throw new PersistenceException(e);
}