diff --git a/orient-ra/src/main/java/org/ops4j/orient/adapter/impl/OrientManagedConnectionImpl.java b/orient-ra/src/main/java/org/ops4j/orient/adapter/impl/OrientManagedConnectionImpl.java
index 6ed1e7a..fc0b9ac 100644
--- a/orient-ra/src/main/java/org/ops4j/orient/adapter/impl/OrientManagedConnectionImpl.java
+++ b/orient-ra/src/main/java/org/ops4j/orient/adapter/impl/OrientManagedConnectionImpl.java
@@ -66,23 +66,39 @@ class OrientLocalTransaction implements LocalTransaction {
@Override
public void begin() throws ResourceException {
- log.debug("begin()");
- db.begin();
- fireConnectionEvent(LOCAL_TRANSACTION_STARTED);
+ try {
+ log.debug("begin()");
+ if (db.isClosed()) {
+ log.debug("db connection closed, reopening...");
+ openDatabase();
+ }
+ db.begin();
+ fireConnectionEvent(LOCAL_TRANSACTION_STARTED);
+ } catch (RuntimeException e) {
+ throw new ResourceException(e);
+ }
}
@Override
public void commit() throws ResourceException {
- log.debug("commit()");
- db.commit();
- fireConnectionEvent(LOCAL_TRANSACTION_COMMITTED);
+ try {
+ log.debug("commit()");
+ db.commit();
+ fireConnectionEvent(LOCAL_TRANSACTION_COMMITTED);
+ } catch (RuntimeException e) {
+ throw new ResourceException(e);
+ }
}
@Override
public void rollback() throws ResourceException {
- log.debug("rollback()");
- db.rollback();
- fireConnectionEvent(LOCAL_TRANSACTION_ROLLEDBACK);
+ try {
+ log.debug("rollback()");
+ db.rollback();
+ fireConnectionEvent(LOCAL_TRANSACTION_ROLLEDBACK);
+ } catch (RuntimeException e) {
+ throw new ResourceException(e);
+ }
}
}
@@ -112,11 +128,11 @@ private void createDatabaseHandle() {
log.debug("instantiating Orient Database of type [{}] with URL [{}]", type, url);
if (type.equals("document")) {
- this.db = new ODatabaseDocumentTx(url);
+ this.db = new ODatabaseDocumentTx(url, true);
} else if (type.equals("object")) {
this.db = new OObjectDatabaseTx(url);
} else if (type.equals("graph")) {
- this.db = new ODatabaseDocumentTx(url);
+ this.db = new ODatabaseDocumentTx(url, true);
}
}
diff --git a/pom.xml b/pom.xml
index b45ee70..738a9bd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
2.6.0
4.1
1.0.4
- 2.0.1
+ 2.0.13
1.6.6
4.1.4.RELEASE
8.2.0.Final