Package org.hibernate

Examples of org.hibernate.AnnotationException


      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

  protected AttributeConverterDefinition makeAttributeConverterDefinition(AttributeConversionInfo conversion) {
    try {
      return new AttributeConverterDefinition( conversion.getConverterClass().newInstance(), false );
    }
    catch (Exception e) {
      throw new AnnotationException( "Unable to create AttributeConverter instance", e );
    }
  }
View Full Code Here

    }
  }

  protected boolean areTypeMatch(Class converterDefinedType, Class propertyType) {
    if ( converterDefinedType == null ) {
      throw new AnnotationException( "AttributeConverter defined java type cannot be null" );
    }
    if ( propertyType == null ) {
      throw new AnnotationException( "Property defined java type cannot be null" );
    }

    return converterDefinedType.equals( propertyType )
        || PrimitiveWrapperHelper.arePrimitiveWrapperEquivalents( converterDefinedType, propertyType );
  }
View Full Code Here

    if ( access != null ) {
      try {
        type = AccessType.valueOf( access );
      }
      catch ( IllegalArgumentException e ) {
        throw new AnnotationException( "Invalid access type " + access + " (check your xml configuration)" );
      }
      defaultType.setAccess( type );
    }
  }
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

        new Column(
            mappings.getPhysicalColumnName( columnName, table )
        )
    );
    if ( column == null ) {
      throw new AnnotationException(
          "@Index references a unknown column: " + columnName
      );
    }
    if ( unique )
      table.getOrCreateUniqueKey( indexName ).addColumn( column );
View Full Code Here

          }
        }
        columnsList.append( "referencing " )
            .append( ownerEntity.getEntityName() )
            .append( " not mapped to a single property" );
        throw new AnnotationException( columnsList.toString() );
      }

      /**
       * creating the property ref to the new synthetic property
       */
 
View Full Code Here

    if ( !isEmptyAnnotationValue( generatorName ) ) {
      //we have a named generator
      IdGenerator gen = mappings.getGenerator( generatorName, localGenerators );
      if ( gen == null ) {
        throw new AnnotationException( "Unknown Id.generator: " + generatorName );
      }
      //This is quite vague in the spec but a generator could override the generate choice
      String identifierGeneratorStrategy = gen.getIdentifierGeneratorStrategy();
      //yuk! this is a hack not to override 'AUTO' even if generator is set
      final boolean avoidOverriding =
View Full Code Here

        }
      }
      if ( !values.isEmpty() ) value.setMetaValues( values );
    }
    else {
      throw new AnnotationException( "Unable to find @AnyMetaDef for an @(ManyTo)Any mapping: "
          + StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() ) );
    }

    value.setCascadeDeleteEnabled( cascadeOnDelete );
    if ( !optional ) {
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.