Package org.hibernate.annotations

Examples of org.hibernate.annotations.OptimisticLock


          "Cannot use sql order by clause in conjunction of EJB3 order by clause: " + safeCollectionRole()
      );
    }

    collection.setMutable( !property.isAnnotationPresent( Immutable.class ) );
    OptimisticLock lockAnn = property.getAnnotation( OptimisticLock.class );
    if ( lockAnn != null ) collection.setOptimisticLocked( !lockAnn.excluded() );
    Persister persisterAnn = property.getAnnotation( Persister.class );
    if ( persisterAnn != null ) collection.setCollectionPersisterClass( persisterAnn.impl() );

    // set ordering
    if ( orderBy != null ) collection.setOrderBy( orderBy );
View Full Code Here


      }
      prop.setNaturalIdentifier( true );
    }
    prop.setInsertable( insertable );
    prop.setUpdateable( updatable );
    OptimisticLock lockAnn = property != null ?
        property.getAnnotation( OptimisticLock.class ) :
        null;
    if ( lockAnn != null ) {
      prop.setOptimisticLocked( !lockAnn.excluded() );
      //TODO this should go to the core as a mapping validation checking
      if ( lockAnn.excluded() && (
          property.isAnnotationPresent( javax.persistence.Version.class )
              || property.isAnnotationPresent( Id.class )
              || property.isAnnotationPresent( EmbeddedId.class ) ) ) {
        throw new AnnotationException( "@OptimisticLock.exclude=true incompatible with @Id, @EmbeddedId and @Version: "
            + StringHelper.qualify( holder.getPath(), name ) );
View Full Code Here

          "Cannot use sql order by clause in conjunction of EJB3 order by clause: " + safeCollectionRole()
      );
    }

    collection.setMutable( !property.isAnnotationPresent( Immutable.class ) );
    OptimisticLock lockAnn = property.getAnnotation( OptimisticLock.class );
    if ( lockAnn != null ) collection.setOptimisticLocked( !lockAnn.excluded() );

    Persister persisterAnn = property.getAnnotation( Persister.class );
    if ( persisterAnn != null ) {
      collection.setCollectionPersisterClass( persisterAnn.impl() );
    }
View Full Code Here

      }
      prop.setNaturalIdentifier( true );
    }
    prop.setInsertable( insertable );
    prop.setUpdateable( updatable );
    OptimisticLock lockAnn = property != null ?
        property.getAnnotation( OptimisticLock.class ) :
        null;
    if ( lockAnn != null ) {
      prop.setOptimisticLocked( !lockAnn.excluded() );
      //TODO this should go to the core as a mapping validation checking
      if ( lockAnn.excluded() && (
          property.isAnnotationPresent( javax.persistence.Version.class )
              || property.isAnnotationPresent( Id.class )
              || property.isAnnotationPresent( EmbeddedId.class ) ) ) {
        throw new AnnotationException(
            "@OptimisticLock.exclude=true incompatible with @Id, @EmbeddedId and @Version: "
View Full Code Here

    collection.setMutable( !property.isAnnotationPresent( Immutable.class ) );

    //work on association
    boolean isMappedBy = !BinderHelper.isEmptyAnnotationValue( mappedBy );

    final OptimisticLock lockAnn = property.getAnnotation( OptimisticLock.class );
    final boolean includeInOptimisticLockChecks = ( lockAnn != null )
        ? ! lockAnn.excluded()
        : ! isMappedBy;
    collection.setOptimisticLocked( includeInOptimisticLockChecks );

    Persister persisterAnn = property.getAnnotation( Persister.class );
    if ( persisterAnn != null ) {
View Full Code Here

    // this is already handled for collections in CollectionBinder...
    if ( Collection.class.isInstance( value ) ) {
      prop.setOptimisticLocked( ( (Collection) value ).isOptimisticLocked() );
    }
    else {
      final OptimisticLock lockAnn = property != null
          ? property.getAnnotation( OptimisticLock.class )
          : null;
      if ( lockAnn != null ) {
        //TODO this should go to the core as a mapping validation checking
        if ( lockAnn.excluded() && (
            property.isAnnotationPresent( javax.persistence.Version.class )
                || property.isAnnotationPresent( Id.class )
                || property.isAnnotationPresent( EmbeddedId.class ) ) ) {
          throw new AnnotationException(
              "@OptimisticLock.exclude=true incompatible with @Id, @EmbeddedId and @Version: "
                  + StringHelper.qualify( holder.getPath(), name )
          );
        }
      }
      final boolean isOwnedValue = !isToOneValue( value ) || insertable; // && updatable as well???
      final boolean includeInOptimisticLockChecks = ( lockAnn != null )
          ? ! lockAnn.excluded()
          : isOwnedValue;
      prop.setOptimisticLocked( includeInOptimisticLockChecks );
    }

    LOG.tracev( "Cascading {0} with {1}", name, cascade );
View Full Code Here

    // this is already handled for collections in CollectionBinder...
    if ( Collection.class.isInstance( value ) ) {
      prop.setOptimisticLocked( ( (Collection) value ).isOptimisticLocked() );
    }
    else {
      final OptimisticLock lockAnn = property != null
          ? property.getAnnotation( OptimisticLock.class )
          : null;
      if ( lockAnn != null ) {
        //TODO this should go to the core as a mapping validation checking
        if ( lockAnn.excluded() && (
            property.isAnnotationPresent( javax.persistence.Version.class )
                || property.isAnnotationPresent( Id.class )
                || property.isAnnotationPresent( EmbeddedId.class ) ) ) {
          throw new AnnotationException(
              "@OptimisticLock.exclude=true incompatible with @Id, @EmbeddedId and @Version: "
                  + StringHelper.qualify( holder.getPath(), name )
          );
        }
      }
      final boolean isOwnedValue = !isToOneValue( value ) || insertable; // && updatable as well???
      final boolean includeInOptimisticLockChecks = ( lockAnn != null )
          ? ! lockAnn.excluded()
          : isOwnedValue;
      prop.setOptimisticLocked( includeInOptimisticLockChecks );
    }

    LOG.tracev( "Cascading {0} with {1}", name, cascade );
View Full Code Here

    collection.setMutable( !property.isAnnotationPresent( Immutable.class ) );

    //work on association
    boolean isMappedBy = !BinderHelper.isEmptyAnnotationValue( mappedBy );

    final OptimisticLock lockAnn = property.getAnnotation( OptimisticLock.class );
    final boolean includeInOptimisticLockChecks = ( lockAnn != null )
        ? ! lockAnn.excluded()
        : ! isMappedBy;
    collection.setOptimisticLocked( includeInOptimisticLockChecks );

    Persister persisterAnn = property.getAnnotation( Persister.class );
    if ( persisterAnn != null ) {
View Full Code Here

          "Cannot use sql order by clause in conjunction of EJB3 order by clause: " + safeCollectionRole()
      );
    }

    collection.setMutable( !property.isAnnotationPresent( Immutable.class ) );
    OptimisticLock lockAnn = property.getAnnotation( OptimisticLock.class );
    if ( lockAnn != null ) collection.setOptimisticLocked( !lockAnn.excluded() );

    Persister persisterAnn = property.getAnnotation( Persister.class );
    if ( persisterAnn != null ) {
      collection.setCollectionPersisterClass( persisterAnn.impl() );
    }
View Full Code Here

    collection.setMutable( !property.isAnnotationPresent( Immutable.class ) );

    //work on association
    boolean isMappedBy = !BinderHelper.isEmptyAnnotationValue( mappedBy );

    final OptimisticLock lockAnn = property.getAnnotation( OptimisticLock.class );
    final boolean includeInOptimisticLockChecks = ( lockAnn != null )
        ? ! lockAnn.excluded()
        : ! isMappedBy;
    collection.setOptimisticLocked( includeInOptimisticLockChecks );

    Persister persisterAnn = property.getAnnotation( Persister.class );
    if ( persisterAnn != null ) {
View Full Code Here

TOP

Related Classes of org.hibernate.annotations.OptimisticLock

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.