[Minor] Throw exception if forget to commit
This commit is contained in:
parent
97a0c076a4
commit
4153c9bb14
|
@ -114,6 +114,8 @@ public class CachedRealm extends InternalStrolchRealm {
|
||||||
int nrOfResources = 0;
|
int nrOfResources = 0;
|
||||||
int nrOfActivities = 0;
|
int nrOfActivities = 0;
|
||||||
|
|
||||||
|
logger.info(MessageFormat.format("Loading Model from Database for realm {0}...", getRealm())); //$NON-NLS-1$
|
||||||
|
|
||||||
try (StrolchTransaction tx = openTx(privilegeContext.getCertificate(), "strolch_boot")) {
|
try (StrolchTransaction tx = openTx(privilegeContext.getCertificate(), "strolch_boot")) {
|
||||||
ResourceDao resourceDao = tx.getPersistenceHandler().getResourceDao(tx);
|
ResourceDao resourceDao = tx.getPersistenceHandler().getResourceDao(tx);
|
||||||
Set<String> resourceTypes = resourceDao.queryTypes();
|
Set<String> resourceTypes = resourceDao.queryTypes();
|
||||||
|
|
|
@ -932,7 +932,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
|
||||||
throw new IllegalStateException(msg);
|
throw new IllegalStateException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.objectFilter.isEmpty()) {
|
if (this.objectFilter != null && !this.objectFilter.isEmpty()) {
|
||||||
autoCloseableRollback();
|
autoCloseableRollback();
|
||||||
String msg = "There are modified objects registered on a read-only transaction. Changing to rollback! Did you forget to commit?";
|
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