Package org.hibernate

Examples of org.hibernate.AssertionFailure


  }

  @Override
  protected boolean isClassOrSuperclassTable(int j) {
    if ( j != 0 ) {
      throw new AssertionFailure( "only one table" );
    }
    return true;
  }
View Full Code Here


  }

  @Override
  public void processInsertGeneratedProperties(Serializable id, Object entity, Object[] state, SessionImplementor session) {
    if ( !hasUpdateGeneratedProperties() ) {
      throw new AssertionFailure("no insert-generated properties");
    }
    processGeneratedProperties( id, entity, state, session, GenerationTiming.INSERT );
  }
View Full Code Here

  }

  @Override
  public void processUpdateGeneratedProperties(Serializable id, Object entity, Object[] state, SessionImplementor session) {
    if ( !hasUpdateGeneratedProperties() ) {
      throw new AssertionFailure("no update-generated properties");
    }
    processGeneratedProperties( id, entity, state, session, GenerationTiming.ALWAYS );
  }
View Full Code Here

      case SECOND:
        return CALENDAR_SECOND;
      case MILLISECOND:
        return CALENDAR_MILLISECOND;
      default:
        throw new AssertionFailure( "Unknown Resolution: " + resolution );
    }
  }
View Full Code Here

    }
    else if ( readState == 2 ) {
      return directory2;
    }
    else {
      throw new AssertionFailure( "Illegal current directory: " + readState );
    }
  }
View Full Code Here

        break;
      case MILLISECOND:
        resolution = DateTools.Resolution.MILLISECOND;
        break;
      default:
        throw new AssertionFailure( "Unknown Resolution: " + hibResolution );
    }
    return resolution;
  }
View Full Code Here

      case SECOND:
        return DATE_SECOND;
      case MILLISECOND:
        return DATE_MILLISECOND;
      default:
        throw new AssertionFailure( "Unknown Resolution: " + resolution );
    }
  }
View Full Code Here

  }

  @Override
  public Object forceVersionIncrement(Serializable id, Object currentVersion, SessionImplementor session) {
    if ( !isVersioned() ) {
      throw new AssertionFailure( "cannot force version increment on non-versioned entity" );
    }

    if ( isVersionPropertyGenerated() ) {
      // the difficulty here is exactly what do we update in order to
      // force the version to be incremented in the db...
View Full Code Here

    final GridType gridUniqueKeyType = getUniqueKeyTypeFromAssociatedEntity( propertyIndex, propertyName );
    //get the associated property index (to get its column names)
    //find the ids per unique property name
    AssociationKeyMetadata associationKeyMetadata = associationKeyMetadataPerPropertyName.get( propertyName );
    if ( associationKeyMetadata == null ) {
      throw new AssertionFailure( "loadByUniqueKey on a non EntityType:" + propertyName );
    }
    AssociationPersister associationPersister = new AssociationPersister(
          getMappedClass()
        )
        .gridDialect( gridDialect )
        .key( uniqueKey )
        .keyGridType( gridUniqueKeyType )
        //does not set .collectionPersister as it does not make sense here for an entity
        .associationKeyMetadata( associationKeyMetadata )
        .session( session )
        .propertyType( getPropertyTypes()[propertyIndex] );
    final Association ids = associationPersister.getAssociationOrNull();

    if (ids == null || ids.size() == 0 ) {
      return null;
    }
    else if (ids.size() == 1) {
      //EntityLoader#loadByUniqueKey uses a null object and LockMode.NONE
      //there is only one element in the list, so get the first
      Tuple tuple = ids.get( ids.getKeys().iterator().next() );
      final Serializable id = (Serializable) getGridIdentifierType().nullSafeGet( tuple, getIdentifierColumnNames(), session, null );
      return load( id, null, LockMode.NONE, session );
    }
    else {
      throw new AssertionFailure(
          "Loading by unique key but finding several matches: table:" + getTableName()
              + " property: " + propertyName
              + " value: " + uniqueKey );
    }
  }
View Full Code Here

      EntityType entityType = (EntityType) uniqueKeyType;
      final OgmEntityPersister entityPersister = (OgmEntityPersister) entityType.getAssociatedJoinable( getFactory() );
      gridUniqueKeyType = entityPersister.getGridIdentifierType();
    }
    else {
      throw new AssertionFailure( "loadByUniqueKey on a non EntityType:" + propertyName );
    }
    return gridUniqueKeyType;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.AssertionFailure

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.