/** * INTERNAL: * There is a very special case where a query may be a bean-level * pessimistic locking query. * <p> * If that is so, only queries executed inside of a UnitOfWork should * have a locking clause. In the extremely rare case that we execute * a locking query outside of a UnitOfWork, must disable locking so that * we do not get a fetch out of sequence error. */ public DatabaseQuery prepareOutsideUnitOfWork(AbstractSession session) { // Implementation is complicated because: if locking refresh will be // auto set to true preventing cache hit. // Must prepare this query from scratch if outside uow but locking // Must not reprepare this query as a NO_LOCK, but create a clone first // Must not cloneAndUnPrepare unless really have to if (isLockQuery(session) && getLockingClause().isForUpdateOfClause()) { ObjectLevelReadQuery clone = (ObjectLevelReadQuery)clone(); clone.setIsExecutionClone(true); clone.dontAcquireLocks(); clone.setIsPrepared(false); clone.checkPrePrepare(session); return clone; } return this; }
/** * INTERNAL: * There is a very special case where a query may be a bean-level * pessimistic locking query. * <p> * If that is so, only queries executed inside of a UnitOfWork should * have a locking clause. In the extremely rare case that we execute * a locking query outside of a UnitOfWork, must disable locking so that * we do not get a fetch out of sequence error. */ public DatabaseQuery prepareOutsideUnitOfWork(AbstractSession session) { // Implementation is complicated because: if locking refresh will be // auto set to true preventing cache hit. // Must prepare this query from scratch if outside uow but locking // Must not reprepare this query as a NO_LOCK, but create a clone first // Must not cloneAndUnPrepare unless really have to if (isLockQuery(session) && getLockingClause().isForUpdateOfClause()) { ObjectLevelReadQuery clone = (ObjectLevelReadQuery)clone(); clone.setIsExecutionClone(true); clone.dontAcquireLocks(); clone.setIsPrepared(false); clone.checkPrePrepare(session); return clone; } return this; }
/** * INTERNAL: * There is a very special case where a query may be a bean-level * pessimistic locking query. * <p> * If that is so, only queries executed inside of a UnitOfWork should * have a locking clause. In the extremely rare case that we execute * a locking query outside of a UnitOfWork, must disable locking so that * we do not get a fetch out of sequence error. */ public DatabaseQuery prepareOutsideUnitOfWork(AbstractSession session) { // Implementation is complicated because: if locking refresh will be // auto set to true preventing cache hit. // Must prepare this query from scratch if outside uow but locking // Must not reprepare this query as a NO_LOCK, but create a clone first // Must not cloneAndUnPrepare unless really have to if (isLockQuery(session) && getLockingClause().isForUpdateOfClause()) { ObjectLevelReadQuery clone = (ObjectLevelReadQuery)clone(); clone.setIsExecutionClone(true); clone.dontAcquireLocks(); clone.setIsPrepared(false); clone.checkPrePrepare(session); return clone; } return this; }
if (((ObjectLevelReadQuery)baseQuery).getLockingClause().isForUpdateOfClause()) { ForUpdateOfClause clause = (ForUpdateOfClause)((ObjectLevelReadQuery)baseQuery).getLockingClause().clone(); clause.setLockedExpressions(extractNestedExpressions(clause.getLockedExpressions(), nestedQuery.getExpressionBuilder(), true)); nestedQuery.setLockingClause(clause); } else { nestedQuery.setLockingClause(((ObjectLevelReadQuery)baseQuery).getLockingClause());
if (((ObjectLevelReadQuery)baseQuery).getLockingClause().isForUpdateOfClause()) { ForUpdateOfClause clause = (ForUpdateOfClause)((ObjectLevelReadQuery)baseQuery).getLockingClause().clone(); clause.setLockedExpressions(extractNestedNonAggregateExpressions(clause.getLockedExpressions(), nestedQuery.getExpressionBuilder(), true)); nestedQuery.setLockingClause(clause); } else { nestedQuery.setLockingClause(((ObjectLevelReadQuery)baseQuery).getLockingClause());
if (((ObjectLevelReadQuery)baseQuery).getLockingClause().isForUpdateOfClause()) { ForUpdateOfClause clause = (ForUpdateOfClause)((ObjectLevelReadQuery)baseQuery).getLockingClause().clone(); clause.setLockedExpressions(extractNestedNonAggregateExpressions(clause.getLockedExpressions(), nestedQuery.getExpressionBuilder(), true)); nestedQuery.setLockingClause(clause); } else { nestedQuery.setLockingClause(((ObjectLevelReadQuery)baseQuery).getLockingClause());
ObjectLevelReadQuery query = (ObjectLevelReadQuery)getQuery(); selectStatement.setQuery(query); selectStatement.setLockingClause(query.getLockingClause()); selectStatement.setDistinctState(query.getDistinctState()); selectStatement.setTables((Vector)getDescriptor().getTables().clone());
ObjectLevelReadQuery query = (ObjectLevelReadQuery)getQuery(); selectStatement.setQuery(query); selectStatement.setLockingClause(query.getLockingClause()); selectStatement.setDistinctState(query.getDistinctState()); selectStatement.setTables((Vector)getDescriptor().getTables().clone());
ObjectLevelReadQuery query = (ObjectLevelReadQuery)getQuery(); selectStatement.setQuery(query); selectStatement.setLockingClause(query.getLockingClause()); selectStatement.setDistinctState(query.getDistinctState()); selectStatement.setTables((Vector)getDescriptor().getTables().clone());