[Minor] Throw exception if forget to commit
This commit is contained in:
parent
e128d42365
commit
97a0c076a4
|
@ -928,7 +928,13 @@ public abstract class AbstractTransaction implements StrolchTransaction {
|
||||||
|
|
||||||
if (!this.commands.isEmpty()) {
|
if (!this.commands.isEmpty()) {
|
||||||
autoCloseableRollback();
|
autoCloseableRollback();
|
||||||
String msg = "There are commands registered on a read-only transaction. Changing to rollback! Probably due to an exception!";
|
String msg = "There are commands registered on a read-only transaction. Changing to rollback! Did you forget to commit?";
|
||||||
|
throw new IllegalStateException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.objectFilter.isEmpty()) {
|
||||||
|
autoCloseableRollback();
|
||||||
|
String msg = "There are modified objects registered on a read-only transaction. Changing to rollback! Did you forget to commit?";
|
||||||
throw new IllegalStateException(msg);
|
throw new IllegalStateException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue