Merge pull request #316 from castovoid/master

Resolve NullPointerException on JtaTransacionManager constructor
This commit is contained in:
Rob Bygrave
2015-06-30 21:17:27 +12:00
@@ -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);
}