/** * PUBLIC: * Answers if the query lock mode is known to be LOCK or LOCK_NOWAIT. * * In the case of DEFAULT_LOCK_MODE and the query reference class being a CMP entity bean, * at execution time LOCK, LOCK_NOWAIT, or NO_LOCK will be decided. * <p> * If a single joined attribute was configured for pessimistic locking then * this will return true (after first execution) as the SQL contained a * FOR UPDATE OF clause. */ public boolean isLockQuery() { return getLockMode() > NO_LOCK; }
/** * PUBLIC: * Answers if the query lock mode is known to be LOCK or LOCK_NOWAIT. * * In the case of DEFAULT_LOCK_MODE and the query reference class being a CMP entity bean, * at execution time LOCK, LOCK_NOWAIT, or NO_LOCK will be decided. * <p> * If a single joined attribute was configured for pessimistic locking then * this will return true (after first execution) as the SQL contained a * FOR UPDATE OF clause. */ public boolean isLockQuery() { return getLockMode() > NO_LOCK; }
/** * PUBLIC: * Answers if the query lock mode is known to be LOCK or LOCK_NOWAIT. * * In the case of DEFAULT_LOCK_MODE and the query reference class being a CMP entity bean, * at execution time LOCK, LOCK_NOWAIT, or NO_LOCK will be decided. * <p> * If a single joined attribute was configured for pessimistic locking then * this will return true (after first execution) as the SQL contained a * FOR UPDATE OF clause. */ public boolean isLockQuery() { return getLockMode() > NO_LOCK; }
/** * INTERNAL: * Called if shouldExtendPessimisticLockScopeInTargetQuery() is true. * Adds locking clause to the target query to extend pessimistic lock scope. */ protected void extendPessimisticLockScopeInTargetQuery(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { targetQuery.setLockMode(sourceQuery.getLockMode()); }
/** * INTERNAL: * Called if shouldExtendPessimisticLockScopeInTargetQuery() is true. * Adds locking clause to the target query to extend pessimistic lock scope. */ protected void extendPessimisticLockScopeInTargetQuery(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { targetQuery.setLockMode(sourceQuery.getLockMode()); }
/** * INTERNAL: * Called if shouldExtendPessimisticLockScopeInTargetQuery() is true. * Adds locking clause to the target query to extend pessimistic lock scope. */ protected void extendPessimisticLockScopeInTargetQuery(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { targetQuery.setLockMode(sourceQuery.getLockMode()); }
/** * INTERNAL: * Return relation table locking clause. */ public void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { ForUpdateOfClause lockingClause = new ForUpdateOfClause(); lockingClause.setLockMode(sourceQuery.getLockMode()); FieldExpression exp = (FieldExpression)targetQuery.getExpressionBuilder().getTable(this.relationTable).getField(this.sourceRelationKeyFields.get(0)); lockingClause.addLockedExpression(exp); targetQuery.setLockingClause(lockingClause); // locking clause is not compatible with DISTINCT targetQuery.setShouldOuterJoinSubclasses(true); }
/** * INTERNAL: * Return relation table locking clause. */ public void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { ForUpdateOfClause lockingClause = new ForUpdateOfClause(); lockingClause.setLockMode(sourceQuery.getLockMode()); FieldExpression exp = (FieldExpression)targetQuery.getExpressionBuilder().getTable(this.relationTable).getField(this.sourceRelationKeyFields.get(0)); lockingClause.addLockedExpression(exp); targetQuery.setLockingClause(lockingClause); // locking clause is not compatible with DISTINCT targetQuery.setShouldOuterJoinSubclasses(true); }
/** * INTERNAL: * Return relation table locking clause. */ public void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { ForUpdateOfClause lockingClause = new ForUpdateOfClause(); lockingClause.setLockMode(sourceQuery.getLockMode()); FieldExpression exp = (FieldExpression)targetQuery.getExpressionBuilder().getTable(this.relationTable).getField(this.sourceRelationKeyFields.get(0)); lockingClause.addLockedExpression(exp); targetQuery.setLockingClause(lockingClause); // locking clause is not compatible with DISTINCT targetQuery.setShouldOuterJoinSubclasses(true); }
int lockMode = ((ObjectBuildingQuery)statement.getQuery()).getLockMode(); if (lockMode == ObjectBuildingQuery.LOCK || lockMode == ObjectBuildingQuery.LOCK_NOWAIT) { throw new UnsupportedOperationException(
statement.setUseUniqueFieldAliases(true); if (query.isObjectBuildingQuery() && (((ObjectBuildingQuery) query).getLockMode() == ObjectBuildingQuery.LOCK || ((ObjectBuildingQuery) query).getLockMode() == ObjectBuildingQuery.LOCK_NOWAIT)) { if (query.isReadAllQuery() || query.isReadObjectQuery()) {
statement.setLockingClause(new ForUpdateClause(sourceQuery.getLockMode()));
ReadQuery dedicatedQuery = this.getExtendPessimisticLockScopeDedicatedQuery(executionSession, sourceQuery.getLockMode()); executionSession.executeQuery(dedicatedQuery, row);
statement.setLockingClause(new ForUpdateClause(sourceQuery.getLockMode()));
statement.setLockingClause(new ForUpdateClause(sourceQuery.getLockMode()));
ReadQuery dedicatedQuery = getExtendPessimisticLockScopeDedicatedQuery(executionSession, sourceQuery.getLockMode()); executionSession.executeQuery(dedicatedQuery, row);
ReadQuery dedicatedQuery = getExtendPessimisticLockScopeDedicatedQuery(executionSession, sourceQuery.getLockMode()); executionSession.executeQuery(dedicatedQuery, row);