@Override public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map<String, String[]> keyColumnNames) { final Iterator itr = aliasedLockOptions.getAliasLockIterator(); final StringBuilder buffer = new StringBuilder( sql );
@Override protected LockMode[] getLockModes(LockOptions lockOptions) { // unfortunately this stuff can't be cached because // it is per-invocation, not constant for the // QueryTranslator instance HashMap nameLockOptions = new HashMap(); if ( lockOptions == null ) { lockOptions = LockOptions.NONE; } if ( lockOptions.getAliasLockCount() > 0 ) { Iterator iter = lockOptions.getAliasLockIterator(); while ( iter.hasNext() ) { Map.Entry me = (Map.Entry) iter.next(); nameLockOptions.put( getAliasName( (String) me.getKey() ), me.getValue() ); } } LockMode[] lockModesArray = new LockMode[names.length]; for ( int i = 0; i < names.length; i++ ) { LockMode lm = (LockMode) nameLockOptions.get( names[i] ); //if ( lm == null ) lm = LockOptions.NONE; if ( lm == null ) { lm = lockOptions.getLockMode(); } lockModesArray[i] = lm; } return lockModesArray; }
/** * Get the <tt>FOR UPDATE OF column_list</tt> fragment appropriate for this * dialect given the aliases of the columns to be write locked. * * @param aliases The columns to be write locked. * @param lockOptions the lock options to apply * @return The appropriate <tt>FOR UPDATE OF column_list</tt> clause string. */ @SuppressWarnings({"unchecked", "UnusedParameters"}) public String getForUpdateString(String aliases, LockOptions lockOptions) { LockMode lockMode = lockOptions.getLockMode(); final Iterator<Map.Entry<String, LockMode>> itr = lockOptions.getAliasLockIterator(); while ( itr.hasNext() ) { // seek the highest lock mode final Map.Entry<String, LockMode>entry = itr.next(); final LockMode lm = entry.getValue(); if ( lm.greaterThan( lockMode ) ) { lockMode = lm; } } lockOptions.setLockMode( lockMode ); return getForUpdateString( lockOptions ); }
final Iterator<Map.Entry<String, LockMode>> itr = lockOptions.getAliasLockIterator(); while ( itr.hasNext() ) {
public ForUpdateFragment(Dialect dialect, LockOptions lockOptions, Map<String, String[]> keyColumnNames) throws QueryException { this( dialect ); LockMode upgradeType = null; Iterator iter = lockOptions.getAliasLockIterator(); this.lockOptions = lockOptions;
locks.setTimeOut( lockOptions.getTimeOut() ); locks.setScope( lockOptions.getScope() ); Iterator iter = lockOptions.getAliasLockIterator(); while ( iter.hasNext() ) { Map.Entry me = (Map.Entry) iter.next();
public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map keyColumnNames) { Iterator itr = aliasedLockOptions.getAliasLockIterator(); StringBuffer buffer = new StringBuffer( sql ); int correction = 0;
@Override public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map<String, String[]> keyColumnNames) { final Iterator itr = aliasedLockOptions.getAliasLockIterator(); final StringBuilder buffer = new StringBuilder( sql );
public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map keyColumnNames) { Iterator itr = aliasedLockOptions.getAliasLockIterator(); StringBuffer buffer = new StringBuffer( sql ); int correction = 0;
@Override protected LockMode[] getLockModes(LockOptions lockOptions) { // unfortunately this stuff can't be cached because // it is per-invocation, not constant for the // QueryTranslator instance HashMap nameLockOptions = new HashMap(); if ( lockOptions == null) { lockOptions = LockOptions.NONE; } if ( lockOptions.getAliasLockCount() > 0 ) { Iterator iter = lockOptions.getAliasLockIterator(); while ( iter.hasNext() ) { Map.Entry me = ( Map.Entry ) iter.next(); nameLockOptions.put( getAliasName( ( String ) me.getKey() ), me.getValue() ); } } LockMode[] lockModesArray = new LockMode[names.length]; for ( int i = 0; i < names.length; i++ ) { LockMode lm = ( LockMode ) nameLockOptions.get( names[i] ); //if ( lm == null ) lm = LockOptions.NONE; if ( lm == null ) lm = lockOptions.getLockMode(); lockModesArray[i] = lm; } return lockModesArray; }
@Override protected LockMode[] getLockModes(LockOptions lockOptions) { // unfortunately this stuff can't be cached because // it is per-invocation, not constant for the // QueryTranslator instance HashMap nameLockOptions = new HashMap(); if ( lockOptions == null) { lockOptions = LockOptions.NONE; } if ( lockOptions.getAliasLockCount() > 0 ) { Iterator iter = lockOptions.getAliasLockIterator(); while ( iter.hasNext() ) { Map.Entry me = ( Map.Entry ) iter.next(); nameLockOptions.put( getAliasName( ( String ) me.getKey() ), me.getValue() ); } } LockMode[] lockModesArray = new LockMode[names.length]; for ( int i = 0; i < names.length; i++ ) { LockMode lm = ( LockMode ) nameLockOptions.get( names[i] ); //if ( lm == null ) lm = LockOptions.NONE; if ( lm == null ) lm = lockOptions.getLockMode(); lockModesArray[i] = lm; } return lockModesArray; }
/** * Get the <tt>FOR UPDATE OF column_list</tt> fragment appropriate for this * dialect given the aliases of the columns to be write locked. * * @param aliases The columns to be write locked. * @param lockOptions the lock options to apply * @return The appropriate <tt>FOR UPDATE OF column_list</tt> clause string. */ @SuppressWarnings( {"unchecked"}) public String getForUpdateString(String aliases, LockOptions lockOptions) { LockMode lockMode = lockOptions.getLockMode(); Iterator<Map.Entry<String, LockMode>> itr = lockOptions.getAliasLockIterator(); while ( itr.hasNext() ) { // seek the highest lock mode final Map.Entry<String, LockMode>entry = itr.next(); final LockMode lm = entry.getValue(); if ( lm.greaterThan(lockMode) ) { lockMode = lm; } } lockOptions.setLockMode( lockMode ); return getForUpdateString( lockOptions ); }
/** * Get the <tt>FOR UPDATE OF column_list</tt> fragment appropriate for this * dialect given the aliases of the columns to be write locked. * * @param aliases The columns to be write locked. * @param lockOptions the lock options to apply * @return The appropriate <tt>FOR UPDATE OF column_list</tt> clause string. */ @SuppressWarnings({"unchecked", "UnusedParameters"}) public String getForUpdateString(String aliases, LockOptions lockOptions) { LockMode lockMode = lockOptions.getLockMode(); final Iterator<Map.Entry<String, LockMode>> itr = lockOptions.getAliasLockIterator(); while ( itr.hasNext() ) { // seek the highest lock mode final Map.Entry<String, LockMode>entry = itr.next(); final LockMode lm = entry.getValue(); if ( lm.greaterThan( lockMode ) ) { lockMode = lm; } } lockOptions.setLockMode( lockMode ); return getForUpdateString( lockOptions ); }
/** * Get the <tt>FOR UPDATE OF column_list</tt> fragment appropriate for this * dialect given the aliases of the columns to be write locked. * * @param aliases The columns to be write locked. * @param lockOptions the lock options to apply * @return The appropriate <tt>FOR UPDATE OF column_list</tt> clause string. */ @SuppressWarnings( {"unchecked"}) public String getForUpdateString(String aliases, LockOptions lockOptions) { LockMode lockMode = lockOptions.getLockMode(); Iterator<Map.Entry<String, LockMode>> itr = lockOptions.getAliasLockIterator(); while ( itr.hasNext() ) { // seek the highest lock mode final Map.Entry<String, LockMode>entry = itr.next(); final LockMode lm = entry.getValue(); if ( lm.greaterThan(lockMode) ) { lockMode = lm; } } lockOptions.setLockMode( lockMode ); return getForUpdateString( lockOptions ); }
public ForUpdateFragment(Dialect dialect, LockOptions lockOptions, Map keyColumnNames) throws QueryException { this( dialect ); LockMode upgradeType = null; Iterator iter = lockOptions.getAliasLockIterator(); this.lockOptions = lockOptions;
public ForUpdateFragment(Dialect dialect, LockOptions lockOptions, Map keyColumnNames) throws QueryException { this( dialect ); LockMode upgradeType = null; Iterator iter = lockOptions.getAliasLockIterator(); this.lockOptions = lockOptions;
public ForUpdateFragment(Dialect dialect, LockOptions lockOptions, Map<String, String[]> keyColumnNames) throws QueryException { this( dialect ); LockMode upgradeType = null; Iterator iter = lockOptions.getAliasLockIterator(); this.lockOptions = lockOptions;
final Iterator<Map.Entry<String, LockMode>> itr = lockOptions.getAliasLockIterator(); while ( itr.hasNext() ) {
@Override protected String applyLocks(String sql, LockOptions lockOptions, Dialect dialect) throws QueryException { // can't cache this stuff either (per-invocation) final String result; if ( lockOptions == null || ( lockOptions.getLockMode() == LockMode.NONE && lockOptions.getAliasLockCount() == 0 ) ) { return sql; } else { LockOptions locks = new LockOptions(); locks.setLockMode(lockOptions.getLockMode()); locks.setTimeOut(lockOptions.getTimeOut()); locks.setScope(lockOptions.getScope()); Iterator iter = lockOptions.getAliasLockIterator(); while ( iter.hasNext() ) { Map.Entry me = ( Map.Entry ) iter.next(); locks.setAliasSpecificLockMode( getAliasName( ( String ) me.getKey() ), (LockMode) me.getValue() ); } Map keyColumnNames = null; if ( dialect.forUpdateOfColumns() ) { keyColumnNames = new HashMap(); for ( int i = 0; i < names.length; i++ ) { keyColumnNames.put( names[i], persisters[i].getIdentifierColumnNames() ); } } result = dialect.applyLocksToSql( sql, locks, keyColumnNames ); } logQuery( queryString, result ); return result; }
@Override protected String applyLocks(String sql, LockOptions lockOptions, Dialect dialect) throws QueryException { // can't cache this stuff either (per-invocation) final String result; if ( lockOptions == null || ( lockOptions.getLockMode() == LockMode.NONE && lockOptions.getAliasLockCount() == 0 ) ) { return sql; } else { LockOptions locks = new LockOptions(); locks.setLockMode(lockOptions.getLockMode()); locks.setTimeOut(lockOptions.getTimeOut()); locks.setScope(lockOptions.getScope()); Iterator iter = lockOptions.getAliasLockIterator(); while ( iter.hasNext() ) { Map.Entry me = ( Map.Entry ) iter.next(); locks.setAliasSpecificLockMode( getAliasName( ( String ) me.getKey() ), (LockMode) me.getValue() ); } Map keyColumnNames = null; if ( dialect.forUpdateOfColumns() ) { keyColumnNames = new HashMap(); for ( int i = 0; i < names.length; i++ ) { keyColumnNames.put( names[i], persisters[i].getIdentifierColumnNames() ); } } result = dialect.applyLocksToSql( sql, locks, keyColumnNames ); } logQuery( queryString, result ); return result; }