Package org.hibernate.annotations

Examples of org.hibernate.annotations.GenerationTime


    prop.setCascade( cascade );
    prop.setPropertyAccessorName( accessType.getType() );
    Generated ann = property != null ?
        property.getAnnotation( Generated.class ) :
        null;
    GenerationTime generated = ann != null ?
        ann.value() :
        null;
    if ( generated != null ) {
      if ( !GenerationTime.NEVER.equals( generated ) ) {
        if ( property.isAnnotationPresent( javax.persistence.Version.class )
            && GenerationTime.INSERT.equals( generated ) ) {
          throw new AnnotationException( "@Generated(INSERT) on a @Version property not allowed, use ALWAYS: "
              + StringHelper.qualify( holder.getPath(), name ) );
        }
        insertable = false;
        if ( GenerationTime.ALWAYS.equals( generated ) ) {
          updatable = false;
        }
        prop.setGeneration( PropertyGeneration.parse( generated.toString().toLowerCase() ) );
      }
    }
    NaturalId naturalId = property != null ?
        property.getAnnotation( NaturalId.class ) :
        null;
View Full Code Here


    if ( generatedAnnotation != null ) {
      this.isInsertable = false;

      AnnotationValue generationTimeValue = generatedAnnotation.value();
      if ( generationTimeValue != null ) {
        GenerationTime genTime = Enum.valueOf( GenerationTime.class, generationTimeValue.asEnum() );
        if ( GenerationTime.ALWAYS.equals( genTime ) ) {
          this.isUpdatable = false;
          this.propertyGeneration = PropertyGeneration.parse( genTime.toString().toLowerCase() );
        }
      }
    }
  }
View Full Code Here

    prop.setCascade( cascade );
    prop.setPropertyAccessorName( propertyAccessorName );
    Generated ann =  property != null ?
        property.getAnnotation( Generated.class ) :
        null;
    GenerationTime generated = ann != null ?
        ann.value() :
        null;
    if (generated != null) {
      if ( ! GenerationTime.NEVER.equals( generated ) ) {
        if ( property.isAnnotationPresent( javax.persistence.Version.class )
            && GenerationTime.INSERT.equals( generated ) ) {
          throw new AnnotationException("@Generated(INSERT) on a @Version property not allowed, use ALWAYS: "
              + StringHelper.qualify( holder.getPath(), name ) );
        }
        if ( prop.isInsertable() ) {
          throw new AnnotationException("Cannot have @Generated property and insertable columns: "
              + StringHelper.qualify( holder.getPath(), name ) );
        }
        if ( GenerationTime.ALWAYS.equals( generated ) && prop.isUpdateable() ) {
          throw new AnnotationException("Cannot have @Generated(ALWAYS) property and updatable columns: "
              + StringHelper.qualify( holder.getPath(), name ) );
        }
        prop.setGeneration( PropertyGeneration.parse( generated.toString().toLowerCase() ) );
      }
    }
    log.trace( "Cascading " + name + " with " + cascade );
    return prop;
  }
View Full Code Here

    prop.setCascade( cascade );
    prop.setPropertyAccessorName( accessType.getType() );
    Generated ann = property != null ?
        property.getAnnotation( Generated.class ) :
        null;
    GenerationTime generated = ann != null ?
        ann.value() :
        null;
    if ( generated != null ) {
      if ( !GenerationTime.NEVER.equals( generated ) ) {
        if ( property.isAnnotationPresent( javax.persistence.Version.class )
            && GenerationTime.INSERT.equals( generated ) ) {
          throw new AnnotationException(
              "@Generated(INSERT) on a @Version property not allowed, use ALWAYS: "
                  + StringHelper.qualify( holder.getPath(), name )
          );
        }
        insertable = false;
        if ( GenerationTime.ALWAYS.equals( generated ) ) {
          updatable = false;
        }
        prop.setGeneration( PropertyGeneration.parse( generated.toString().toLowerCase() ) );
      }
    }
    NaturalId naturalId = property != null ?
        property.getAnnotation( NaturalId.class ) :
        null;
View Full Code Here

    prop.setCascade( cascade );
    prop.setPropertyAccessorName( propertyAccessorName );
    Generated ann = property != null ?
        property.getAnnotation( Generated.class ) :
        null;
    GenerationTime generated = ann != null ?
        ann.value() :
        null;
    if ( generated != null ) {
      if ( !GenerationTime.NEVER.equals( generated ) ) {
        if ( property.isAnnotationPresent( javax.persistence.Version.class )
            && GenerationTime.INSERT.equals( generated ) ) {
          throw new AnnotationException( "@Generated(INSERT) on a @Version property not allowed, use ALWAYS: "
              + StringHelper.qualify( holder.getPath(), name ) );
        }
        insertable = false;
        if ( GenerationTime.ALWAYS.equals( generated ) ) {
          updatable = false;
        }
        prop.setGeneration( PropertyGeneration.parse( generated.toString().toLowerCase() ) );
      }
    }
    NaturalId naturalId = property != null ?
        property.getAnnotation( NaturalId.class ) :
        null;
View Full Code Here

    prop.setCascade( cascade );
    prop.setPropertyAccessorName( accessType.getType() );
    Generated ann = property != null ?
        property.getAnnotation( Generated.class ) :
        null;
    GenerationTime generated = ann != null ?
        ann.value() :
        null;
    if ( generated != null ) {
      if ( !GenerationTime.NEVER.equals( generated ) ) {
        if ( property.isAnnotationPresent( javax.persistence.Version.class )
            && GenerationTime.INSERT.equals( generated ) ) {
          throw new AnnotationException(
              "@Generated(INSERT) on a @Version property not allowed, use ALWAYS: "
                  + StringHelper.qualify( holder.getPath(), name )
          );
        }
        insertable = false;
        if ( GenerationTime.ALWAYS.equals( generated ) ) {
          updatable = false;
        }
        prop.setGeneration( PropertyGeneration.parse( generated.toString().toLowerCase() ) );
      }
    }
    NaturalId naturalId = property != null ? property.getAnnotation( NaturalId.class ) : null;
    if ( naturalId != null ) {
      if ( ! entityBinder.isRootEntity() ) {
View Full Code Here

    prop.setCascade( cascade );
    prop.setPropertyAccessorName( accessType.getType() );
    Generated ann = property != null ?
        property.getAnnotation( Generated.class ) :
        null;
    GenerationTime generated = ann != null ?
        ann.value() :
        null;
    if ( generated != null ) {
      if ( !GenerationTime.NEVER.equals( generated ) ) {
        if ( property.isAnnotationPresent( javax.persistence.Version.class )
            && GenerationTime.INSERT.equals( generated ) ) {
          throw new AnnotationException(
              "@Generated(INSERT) on a @Version property not allowed, use ALWAYS: "
                  + StringHelper.qualify( holder.getPath(), name )
          );
        }
        insertable = false;
        if ( GenerationTime.ALWAYS.equals( generated ) ) {
          updatable = false;
        }
        prop.setGeneration( PropertyGeneration.parse( generated.toString().toLowerCase() ) );
      }
    }
    NaturalId naturalId = property != null ?
        property.getAnnotation( NaturalId.class ) :
        null;
View Full Code Here

TOP

Related Classes of org.hibernate.annotations.GenerationTime

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.