Package org.hibernate

Examples of org.hibernate.AnnotationException


              XMLContext.buildSafeClassName( attr.getValue(), defaults ),
              this.getClass()
          );
        }
        catch ( ClassNotFoundException e ) {
          throw new AnnotationException( "Unable to find id-class: " + attr.getValue(), e );
        }
        ad.setValue( "value", clazz );
        return AnnotationFactory.create( ad );
      }
      else {
        throw new AnnotationException( "id-class without class. " + SCHEMA_VALIDATION );
      }
    }
    else if ( defaults.canUseJavaAnnotations() ) {
      return getJavaAnnotation( IdClass.class );
    }
View Full Code Here


      String annotationAttributeName = getJavaAttributeNameFromXMLOne( attributeName );
      annotation.setValue( annotationAttributeName, attribute );
    }
    else {
      if ( mandatory ) {
        throw new AnnotationException(
            element.getName() + "." + attributeName + " is mandatory in XML overriding. " + SCHEMA_VALIDATION
        );
      }
    }
  }
View Full Code Here

      try {
        int length = Integer.parseInt( attribute );
        annotation.setValue( annotationAttributeName, length );
      }
      catch ( NumberFormatException e ) {
        throw new AnnotationException(
            element.getPath() + attributeName + " not parseable: " + attribute + " (" + SCHEMA_VALIDATION + ")"
        );
      }
    }
  }
View Full Code Here

      for ( String className : classNames ) {
        try {
          metadataSourceQueue.add( reflectionManager.classForName( className, this.getClass() ) );
        }
        catch ( ClassNotFoundException e ) {
          throw new AnnotationException( "Unable to load class defined in XML: " + className, e );
        }
      }
    }
  }
View Full Code Here

      String dependentTable = sp.getValue().getTable().getQuotedName();
      if ( dependentTable.compareTo( startTable ) == 0 ) {
        StringBuilder sb = new StringBuilder(
            "Foreign key circularity dependency involving the following tables: "
        );
        throw new AnnotationException( sb.toString() );
      }
      buildRecursiveOrderedFkSecondPasses( orderedFkSecondPasses, isADependencyOf, startTable, dependentTable );
      if ( !orderedFkSecondPasses.contains( sp ) ) {
        orderedFkSecondPasses.add( 0, sp );
      }
View Full Code Here

      for ( Column column : unboundNoLogical ) {
        sb.append( column.getName() ).append( ", " );
      }
      sb.setLength( sb.length() - 2 );
      sb.append( " not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)" );
      throw new AnnotationException( sb.toString() );
    }
  }
View Full Code Here

      return classes;
    }

    public void addAnyMetaDef(AnyMetaDef defAnn) throws AnnotationException {
      if ( anyMetaDefs.containsKey( defAnn.name() ) ) {
        throw new AnnotationException( "Two @AnyMetaDef with the same name defined: " + defAnn.name() );
      }
      anyMetaDefs.put( defAnn.name(), defAnn );
    }
View Full Code Here

    return mappedSuperclassAnnotation != null;
  }

  private static void assertNotEntityAndMappedSuperClass(AnnotationInstance jpaEntityAnnotation, AnnotationInstance mappedSuperClassAnnotation, String className) {
    if ( jpaEntityAnnotation != null && mappedSuperClassAnnotation != null ) {
      throw new AnnotationException(
          "An entity cannot be annotated with both @Entity and @MappedSuperclass. " + className + " has both annotations."
      );
    }
  }
View Full Code Here

    }
  }

  private static void assertNotEntityAndEmbeddable(AnnotationInstance jpaEntityAnnotation, AnnotationInstance embeddableAnnotation, String className) {
    if ( jpaEntityAnnotation != null && embeddableAnnotation != null ) {
      throw new AnnotationException(
          "An entity cannot be annotated with both @Entity and @Embeddable. " + className + " has both annotations."
      );
    }
  }
View Full Code Here

      }
      else if ( annotation.target() instanceof MethodInfo ) {
        tmpAccessType = AccessType.PROPERTY;
      }
      else {
        throw new AnnotationException( "Invalid placement of @Id annotation" );
      }

      if ( accessType == null ) {
        accessType = tmpAccessType;
      }
      else {
        if ( !accessType.equals( tmpAccessType ) ) {
          throw new AnnotationException( "Inconsistent placement of @Id annotation within hierarchy " );
        }
      }
    }
    return accessType;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.AnnotationException

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.