/** * INTERNAL: * The locking clause contains a list of expressions representing which * objects are to be locked by the query. * <p> * Use for even finer grained control over what is and is not locked by * a particular query. */ public void setLockingClause(ForUpdateClause clause) { if (clause.isForUpdateOfClause()) { this.lockingClause = clause; setIsPrePrepared(false); } else { setLockMode(clause.getLockMode()); } setWasDefaultLockMode(false); }
/** * INTERNAL: * The locking clause contains a list of expressions representing which * objects are to be locked by the query. * <p> * Use for even finer grained control over what is and is not locked by * a particular query. */ public void setLockingClause(ForUpdateClause clause) { if (clause.isForUpdateOfClause()) { this.lockingClause = clause; setIsPrePrepared(false); } else { setLockMode(clause.getLockMode()); } setWasDefaultLockMode(false); }
/** * INTERNAL: * The locking clause contains a list of expressions representing which * objects are to be locked by the query. * <p> * Use for even finer grained control over what is and is not locked by * a particular query. */ public void setLockingClause(ForUpdateClause clause) { if (clause.isForUpdateOfClause()) { this.lockingClause = clause; setIsPrePrepared(false); } else { setLockMode(clause.getLockMode()); } setWasDefaultLockMode(false); }
/** * 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));
if (((ObjectLevelReadQuery)baseQuery).getLockingClause().isForUpdateOfClause()) { ForUpdateOfClause clause = (ForUpdateOfClause)((ObjectLevelReadQuery)baseQuery).getLockingClause().clone(); clause.setLockedExpressions(extractNestedNonAggregateExpressions(clause.getLockedExpressions(), nestedQuery.getExpressionBuilder(), true));
if (((ObjectLevelReadQuery)baseQuery).getLockingClause().isForUpdateOfClause()) { ForUpdateOfClause clause = (ForUpdateOfClause)((ObjectLevelReadQuery)baseQuery).getLockingClause().clone(); clause.setLockedExpressions(extractNestedNonAggregateExpressions(clause.getLockedExpressions(), nestedQuery.getExpressionBuilder(), true));