[Minor] Throw exception if forget to commit

This commit is contained in:
Robert von Burg 2017-09-08 18:51:23 +02:00
parent 97a0c076a4
commit 4153c9bb14
2 changed files with 4 additions and 2 deletions

View File

@ -108,12 +108,14 @@ public class CachedRealm extends InternalStrolchRealm {
@Override
public void start(PrivilegeContext privilegeContext) {
super.start(privilegeContext);
long start = System.nanoTime();
int nrOfOrders = 0;
int nrOfResources = 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")) {
ResourceDao resourceDao = tx.getPersistenceHandler().getResourceDao(tx);
Set<String> resourceTypes = resourceDao.queryTypes();

View File

@ -932,7 +932,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
throw new IllegalStateException(msg);
}
if (!this.objectFilter.isEmpty()) {
if (this.objectFilter != null && !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);