[Minor] Throw exception if forget to commit
This commit is contained in:
parent
97a0c076a4
commit
4153c9bb14
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue