Package org.hibernate.tuple

Examples of org.hibernate.tuple.InDatabaseValueGenerationStrategy


    String selectClause = concretePropertySelectFragment(
        getRootAlias(),
        new InclusionChecker() {
          @Override
          public boolean includeProperty(int propertyNumber) {
            final InDatabaseValueGenerationStrategy generationStrategy
                = entityMetamodel.getInDatabaseValueGenerationStrategies()[propertyNumber];
            return generationStrategy != null
                && timingsMatch( generationStrategy.getGenerationTiming(), generationTimingToMatch );
          }
        }
    );
    selectClause = selectClause.substring( 2 );
View Full Code Here


      // the incoming 'includeProperty' array only accounts for insertable defined at the root level, it
      // does not account for partially generated composites etc.  We also need to account for generation
      // values
      if ( isPropertyOfTable( i, j ) ) {
        if ( !lobProperties.contains( i ) ) {
          final InDatabaseValueGenerationStrategy generationStrategy = entityMetamodel.getInDatabaseValueGenerationStrategies()[i];
          if ( generationStrategy != null && generationStrategy.getGenerationTiming().includesInsert() ) {
            if ( generationStrategy.referenceColumnsInSql() ) {
              final String[] values;
              if ( generationStrategy.getReferencedColumnValues() == null ) {
                values = propertyColumnWriters[i];
              }
              else {
                final int numberOfColumns = propertyColumnWriters[i].length;
                values = new String[ numberOfColumns ];
                for ( int x = 0; x < numberOfColumns; x++ ) {
                  if ( generationStrategy.getReferencedColumnValues()[x] != null ) {
                    values[x] = generationStrategy.getReferencedColumnValues()[x];
                  }
                  else {
                    values[x] = propertyColumnWriters[i][x];
                  }
                }
View Full Code Here

    // insert-generated identifier.  That wont work if the natural-id is also insert-generated.
    //
    // Assumptions:
    //    * That code checks that there is a natural identifier before making this call, so we assume the same here
    //     * That code assumes a non-composite natural-id, so we assume the same here
    final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ naturalIdPropertyNumbers[0] ];
    return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER;
  }
View Full Code Here

    final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ naturalIdPropertyNumbers[0] ];
    return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER;
  }

  public boolean isVersionGenerated() {
    final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ versionPropertyIndex ];
    return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER;
  }
View Full Code Here

        int columnIndex = 0;
        Iterator subProperties = composite.getPropertyIterator();
        while ( subProperties.hasNext() ) {
          propertyIndex++;
          final Property subProperty = (Property) subProperties.next();
          final InDatabaseValueGenerationStrategy subStrategy = inDatabaseStrategies.get( propertyIndex );

          if ( subStrategy.getGenerationTiming() == GenerationTiming.ALWAYS ) {
            // override the base-line to the more often "ALWAYS"...
            timing = GenerationTiming.ALWAYS;

          }
          if ( subStrategy.referenceColumnsInSql() ) {
            // override base-line value
            referenceColumns = true;
          }
          if ( subStrategy.getReferencedColumnValues() != null ) {
            if ( subStrategy.getReferencedColumnValues().length != subProperty.getColumnSpan() ) {
              throw new ValueGenerationStrategyException(
                  "Internal error : mismatch between number of collected 'referenced column values'" +
                      " and number of columns for composite attribute : " + mappingProperty.getName() +
                      '.' + subProperty.getName()
              );
            }
            System.arraycopy(
                subStrategy.getReferencedColumnValues(),
                0,
                columnValues,
                columnIndex,
                subProperty.getColumnSpan()
            );
View Full Code Here

    String selectClause = concretePropertySelectFragment(
        getRootAlias(),
        new InclusionChecker() {
          @Override
          public boolean includeProperty(int propertyNumber) {
            final InDatabaseValueGenerationStrategy generationStrategy
                = entityMetamodel.getInDatabaseValueGenerationStrategies()[propertyNumber];
            return generationStrategy != null
                && generationStrategy.getGenerationTiming() == generationTimingToMatch;
          }
        }
    );
    selectClause = selectClause.substring( 2 );
View Full Code Here

      // the incoming 'includeProperty' array only accounts for insertable defined at the root level, it
      // does not account for partially generated composites etc.  We also need to account for generation
      // values
      if ( isPropertyOfTable( i, j ) ) {
        if ( !lobProperties.contains( i ) ) {
          final InDatabaseValueGenerationStrategy generationStrategy = entityMetamodel.getInDatabaseValueGenerationStrategies()[i];
          if ( generationStrategy != null && generationStrategy.getGenerationTiming().includesInsert() ) {
            if ( generationStrategy.referenceColumnsInSql() ) {
              final String[] values;
              if ( generationStrategy.getReferencedColumnValues() == null ) {
                values = propertyColumnWriters[i];
              }
              else {
                final int numberOfColumns = propertyColumnWriters[i].length;
                values = new String[ numberOfColumns ];
                for ( int x = 0; x < numberOfColumns; x++ ) {
                  if ( generationStrategy.getReferencedColumnValues()[x] != null ) {
                    values[x] = generationStrategy.getReferencedColumnValues()[x];
                  }
                  else {
                    values[x] = propertyColumnWriters[i][x];
                  }
                }
View Full Code Here

    // insert-generated identifier.  That wont work if the natural-id is also insert-generated.
    //
    // Assumptions:
    //    * That code checks that there is a natural identifier before making this call, so we assume the same here
    //     * That code assumes a non-composite natural-id, so we assume the same here
    final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ naturalIdPropertyNumbers[0] ];
    return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER;
  }
View Full Code Here

    final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ naturalIdPropertyNumbers[0] ];
    return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER;
  }

  public boolean isVersionGenerated() {
    final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ versionPropertyIndex ];
    return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER;
  }
View Full Code Here

        int columnIndex = 0;
        Iterator subProperties = composite.getPropertyIterator();
        while ( subProperties.hasNext() ) {
          propertyIndex++;
          final Property subProperty = (Property) subProperties.next();
          final InDatabaseValueGenerationStrategy subStrategy = inDatabaseStrategies.get( propertyIndex );

          if ( subStrategy.getGenerationTiming() == GenerationTiming.ALWAYS ) {
            // override the base-line to the more often "ALWAYS"...
            timing = GenerationTiming.ALWAYS;

          }
          if ( subStrategy.referenceColumnsInSql() ) {
            // override base-line value
            referenceColumns = true;
          }
          if ( subStrategy.getReferencedColumnValues() != null ) {
            if ( subStrategy.getReferencedColumnValues().length != subProperty.getColumnSpan() ) {
              throw new ValueGenerationStrategyException(
                  "Internal error : mismatch between number of collected 'referenced column values'" +
                      " and number of columns for composite attribute : " + mappingProperty.getName() +
                      '.' + subProperty.getName()
              );
            }
            System.arraycopy(
                subStrategy.getReferencedColumnValues(),
                0,
                columnValues,
                columnIndex,
                subProperty.getColumnSpan()
            );
View Full Code Here

TOP

Related Classes of org.hibernate.tuple.InDatabaseValueGenerationStrategy

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.