Package org.hibernate

Examples of org.hibernate.LockMode


  }

  private static NativeSQLQueryCollectionReturn bindLoadCollection(Element returnElem, Mappings mappings) {
    String alias = returnElem.attributeValue( "alias" );
    String collectionAttribute = returnElem.attributeValue( "role" );
    LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) );
    int dot = collectionAttribute.lastIndexOf( '.' );
    if ( dot == -1 ) {
      throw new MappingException(
          "Collection attribute for sql query return [alias=" + alias +
          "] not formatted correctly {OwnerClassName.propertyName}"
View Full Code Here


            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

    final Map aliasedLockModes = new HashMap();
    final Map keyColumnNames = dialect.forUpdateOfColumns() ? new HashMap() : null;
    final String[] drivingSqlAliases = getAliases();
    for ( int i = 0; i < drivingSqlAliases.length; i++ ) {
      final LockMode lockMode = ( LockMode ) lockModes.get( drivingSqlAliases[i] );
      if ( lockMode != null ) {
        final Lockable drivingPersister = ( Lockable ) getEntityPersisters()[i];
        final String rootSqlAlias = drivingPersister.getRootTableAlias( drivingSqlAliases[i] );
        aliasedLockModes.put( rootSqlAlias, lockMode );
        if ( keyColumnNames != null ) {
View Full Code Here

      return null;
    }
    final int size = entityAliases.length;
    LockMode[] lockModesArray = new LockMode[size];
    for ( int i=0; i<size; i++ ) {
      LockMode lockMode = (LockMode) lockModes.get( entityAliases[i] );
      lockModesArray[i] = lockMode==null ? LockMode.NONE : lockMode;
    }
    return lockModesArray;
  }
View Full Code Here

      lockModes.put( getSQLAlias( subcriteria ), me.getValue() );
    }
    iter = rootCriteria.iterateSubcriteria();
    while ( iter.hasNext() ) {
      CriteriaImpl.Subcriteria subcriteria = ( CriteriaImpl.Subcriteria ) iter.next();
      LockMode lm = subcriteria.getLockMode();
      if ( lm != null ) {
        lockModes.put( getSQLAlias( subcriteria ), lm );
      }
    }
View Full Code Here

    //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

    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

    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

    // it is per-invocation, not constant for the
    // QueryTranslator instance

    LockMode[] lockModesArray = new LockMode[entityAliases.length];
    for ( int i = 0; i < entityAliases.length; i++ ) {
      LockMode lockMode = lockOptions.getEffectiveLockMode( entityAliases[i] );
      if ( lockMode == null ) {
        //NONE, because its the requested lock mode, not the actual!
        lockMode = LockMode.NONE;
      }
      lockModesArray[i] = lockMode;
View Full Code Here

      final Lockable drivingPersister = (Lockable) select.getFromClause()
          .findFromElementByUserOrSqlAlias( userAlias, drivingSqlAlias )
          .getQueryable();
      final String sqlAlias = drivingPersister.getRootTableAlias( drivingSqlAlias );

      final LockMode effectiveLockMode = lockOptions.getEffectiveLockMode( userAlias );
      locks.setAliasSpecificLockMode( sqlAlias, effectiveLockMode );

      if ( keyColumnNames != null ) {
        keyColumnNames.put( sqlAlias, drivingPersister.getRootTableIdentifierColumnNames() );
      }
View Full Code Here

TOP

Related Classes of org.hibernate.LockMode

Copyright © 2018 www.massapicom. 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.