Examples of LockMode


Examples of org.hibernate.LockMode

    Iterator itr = aliasedLockModes.entrySet().iterator();
    StringBuffer buffer = new StringBuffer( sql );
    int correction = 0;
    while ( itr.hasNext() ) {
      final Map.Entry entry = ( Map.Entry ) itr.next();
      final LockMode lockMode = ( LockMode ) entry.getValue();
      if ( lockMode.greaterThan( LockMode.READ ) ) {
        final String alias = ( String ) entry.getKey();
        int start = -1, end = -1;
        if ( sql.endsWith( " " + alias ) ) {
          start = ( sql.length() - alias.length() ) + correction;
          end = start + alias.length();
View Full Code Here

Examples of org.hibernate.LockMode

    //need to hydrate it.

    // grab its state from the ResultSet and keep it in the Session
    // (but don't yet initialize the object itself)
    // note that we acquire LockMode.READ even if it was not requested
    LockMode acquiredLockMode = lockMode == LockMode.NONE ? LockMode.READ : lockMode;
    loadFromResultSet(
        rs,
        i,
        object,
        instanceClass,
View Full Code Here

Examples of org.hibernate.LockMode

            me.getValue() );
      }
    }
    LockMode[] lockModeArray = new LockMode[names.length];
    for ( int i = 0; i < names.length; i++ ) {
      LockMode lm = ( LockMode ) nameLockModes.get( names[i] );
      if ( lm == null ) lm = LockMode.NONE;
      lockModeArray[i] = lm;
    }
    return lockModeArray;
  }
View Full Code Here

Examples of org.hibernate.LockMode

    this.dialect = dialect;
  }

  public ForUpdateFragment(Dialect dialect, LockOptions lockOptions, Map<String, String[]> keyColumnNames) throws QueryException {
    this( dialect );
    LockMode upgradeType = null;
    Iterator iter = lockOptions.getAliasLockIterator();
    this.lockOptions =  lockOptions;

    if ( !iter.hasNext()) {  // no tables referenced
      final LockMode lockMode = lockOptions.getLockMode();
      if ( LockMode.READ.lessThan( lockMode ) ) {
        upgradeType = lockMode;
        this.lockMode = lockMode;
      }
    }

    while ( iter.hasNext() ) {
      final Map.Entry me = ( Map.Entry ) iter.next();
      final LockMode lockMode = ( LockMode ) me.getValue();
      if ( LockMode.READ.lessThan( lockMode ) ) {
        final String tableAlias = ( String ) me.getKey();
        if ( dialect.forUpdateOfColumns() ) {
          String[] keyColumns = keyColumnNames.get( tableAlias ); //use the id column alias
          if ( keyColumns == null ) {
View Full Code Here

Examples of org.hibernate.LockMode

   *
   * @param lockOptions contains the lock mode to apply.
   * @return The appropriate for update fragment.
   */
  public String getForUpdateString(LockOptions lockOptions) {
        LockMode lockMode = lockOptions.getLockMode();
        return getForUpdateString( lockMode, lockOptions.getTimeOut() );
  }
View Full Code Here

Examples of org.hibernate.LockMode

   * @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 );
View Full Code Here

Examples of org.hibernate.LockMode

    else if ( LockModeType.class.isInstance( value ) ) {
      return getLockMode( (LockModeType) value );
    }
    else if ( String.class.isInstance( value ) ) {
      // first try LockMode name
      LockMode lockMode = LockMode.valueOf( (String) value );
      if ( lockMode == null ) {
        try {
          lockMode = getLockMode( LockModeType.valueOf( (String) value ) );
        }
        catch ( Exception ignore ) {
View Full Code Here

Examples of org.hibernate.LockMode

      QueryParameters parameters,
      Dialect dialect,
      List<AfterLoadAction> afterLoadActions) {
    if ( dialect.useFollowOnLocking() ) {
      // currently only one lock mode is allowed in follow-on locking
      final LockMode lockMode = determineFollowOnLockMode( parameters.getLockOptions() );
      final LockOptions lockOptions = new LockOptions( lockMode );
      if ( lockOptions.getLockMode() != LockMode.UPGRADE_SKIPLOCKED ) {
        LOG.usingFollowOnLocking();
        lockOptions.setTimeOut( parameters.getLockOptions().getTimeOut() );
        lockOptions.setScope( parameters.getLockOptions().getScope() );
View Full Code Here

Examples of org.hibernate.LockMode

    }
    return false;
  }

  protected LockMode determineFollowOnLockMode(LockOptions lockOptions) {
    final LockMode lockModeToUse = lockOptions.findGreatestLockMode();

    if ( lockOptions.hasAliasSpecificLockModes() ) {
      LOG.aliasSpecificLockingWithFollowOnLocking( lockModeToUse );
    }
View Full Code Here

Examples of org.hibernate.LockMode

    //need to hydrate it.

    // grab its state from the ResultSet and keep it in the Session
    // (but don't yet initialize the object itself)
    // note that we acquire LockMode.READ even if it was not requested
    LockMode acquiredLockMode = lockMode == LockMode.NONE ? LockMode.READ : lockMode;
    loadFromResultSet(
        rs,
        i,
        object,
        instanceClass,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.