Package org.hibernate

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


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

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

    String entityName = HbmBinder.getEntityName(returnElem, mappings);
    if(entityName==null) {
      throw new MappingException( "<return alias='" + alias + "'> must specify either a class or entity-name");
    }
    LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) );

    PersistentClass pc = mappings.getClass( entityName );
    java.util.Map propertyResults = bindPropertyResults(alias, returnElem, pc, mappings );

    return new NativeSQLQueryRootReturn(
View Full Code Here

  }

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

  }

  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

    this.dialect = dialect;
  }

  public ForUpdateFragment(Dialect dialect, Map lockModes, Map keyColumnNames) throws QueryException {
    this( dialect );
    LockMode upgradeType = null;
    Iterator iter = lockModes.entrySet().iterator();
    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 = ( String[] ) keyColumnNames.get( tableAlias ); //use the id column alias
          if ( keyColumns == null ) {
View Full Code Here

    String entityName = HbmBinder.getEntityName(returnElem, mappings);
    if(entityName==null) {
      throw new MappingException( "<return alias='" + alias + "'> must specify either a class or entity-name");
    }
    LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) );

    PersistentClass pc = mappings.getClass( entityName );
    java.util.Map propertyResults = bindPropertyResults(alias, returnElem, pc, mappings );

    return new NativeSQLQueryRootReturn(
View Full Code Here

  }

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

  }

  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

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.