Examples of AnnotationDescriptor


Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

  private void processEventAnnotations(List<Annotation> annotationList, XMLContext.Default defaults) {
    boolean eventElement = false;
    for ( Element element : elementsForProperty ) {
      String elementName = element.getName();
      if ( "pre-persist".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PrePersist.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "pre-remove".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PreRemove.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "pre-update".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PreUpdate.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "post-persist".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PostPersist.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "post-remove".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PostRemove.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "post-update".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PostUpdate.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "post-load".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PostLoad.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
    }
    if ( !eventElement && defaults.canUseJavaAnnotations() ) {
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

          throw new AnnotationException(
              "Unable to find " + element.getPath() + ".class: " + className, e
          );
        }
      }
      AnnotationDescriptor ad = new AnnotationDescriptor( EntityListeners.class );
      ad.setValue( "value", entityListenerClasses.toArray( new Class[entityListenerClasses.size()] ) );
      return AnnotationFactory.create( ad );
    }
    else if ( defaults.canUseJavaAnnotations() ) {
      return getJavaAnnotation( EntityListeners.class );
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

        );
    final Class<JoinTable> annotationType = JoinTable.class;
    if ( defaultToJoinTable
        && ( StringHelper.isNotEmpty( defaults.getCatalog() )
        || StringHelper.isNotEmpty( defaults.getSchema() ) ) ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( annotationType );
      if ( defaults.canUseJavaAnnotations() ) {
        JoinTable table = getJavaAnnotation( annotationType );
        if ( table != null ) {
          ad.setValue( "name", table.name() );
          ad.setValue( "schema", table.schema() );
          ad.setValue( "catalog", table.catalog() );
          ad.setValue( "uniqueConstraints", table.uniqueConstraints() );
          ad.setValue( "joinColumns", table.joinColumns() );
          ad.setValue( "inverseJoinColumns", table.inverseJoinColumns() );
        }
      }
      if ( StringHelper.isEmpty( (String) ad.valueOf( "schema" ) )
          && StringHelper.isNotEmpty( defaults.getSchema() ) ) {
        ad.setValue( "schema", defaults.getSchema() );
      }
      if ( StringHelper.isEmpty( (String) ad.valueOf( "catalog" ) )
          && StringHelper.isNotEmpty( defaults.getCatalog() ) ) {
        ad.setValue( "catalog", defaults.getCatalog() );
      }
      return AnnotationFactory.create( ad );
    }
    else if ( defaults.canUseJavaAnnotations() ) {
      return getJavaAnnotation( annotationType );
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

    final Class<JoinTable> annotationType = JoinTable.class;
    if ( subelement == null ) {
      return null;
    }
    //ignore java annotation, an element is defined
    AnnotationDescriptor annotation = new AnnotationDescriptor( annotationType );
    copyStringAttribute( annotation, subelement, "name", false );
    copyStringAttribute( annotation, subelement, "catalog", false );
    if ( StringHelper.isNotEmpty( defaults.getCatalog() )
        && StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) ) {
      annotation.setValue( "catalog", defaults.getCatalog() );
    }
    copyStringAttribute( annotation, subelement, "schema", false );
    if ( StringHelper.isNotEmpty( defaults.getSchema() )
        && StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) {
      annotation.setValue( "schema", defaults.getSchema() );
    }
    buildUniqueConstraints( annotation, subelement );
    annotation.setValue( "joinColumns", getJoinColumns( subelement, false ) );
    annotation.setValue( "inverseJoinColumns", getJoinColumns( subelement, true ) );
    return AnnotationFactory.create( annotation );
  }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

      Class<? extends Annotation> annotationType, List<Annotation> annotationList, XMLContext.Default defaults
  ) {
    String xmlName = annotationToXml.get( annotationType );
    for ( Element element : elementsForProperty ) {
      if ( xmlName.equals( element.getName() ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( annotationType );
        addTargetClass( element, ad, "target-entity", defaults );
        getFetchType( ad, element );
        getCascades( ad, element, defaults );
        getJoinTable( annotationList, element, defaults );
        buildJoinColumns( annotationList, element );
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

  }

  private void buildMapKeyJoinColumns(List<Annotation> annotationList, Element element) {
    MapKeyJoinColumn[] joinColumns = getMapKeyJoinColumns( element );
    if ( joinColumns.length > 0 ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyJoinColumns.class );
      ad.setValue( "value", joinColumns );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

  private MapKeyJoinColumn[] getMapKeyJoinColumns(Element element) {
    List<Element> subelements = element != null ? element.elements( "map-key-join-column" ) : null;
    List<MapKeyJoinColumn> joinColumns = new ArrayList<MapKeyJoinColumn>();
    if ( subelements != null ) {
      for ( Element subelement : subelements ) {
        AnnotationDescriptor column = new AnnotationDescriptor( MapKeyJoinColumn.class );
        copyStringAttribute( column, subelement, "name", false );
        copyStringAttribute( column, subelement, "referenced-column-name", false );
        copyBooleanAttribute( column, subelement, "unique" );
        copyBooleanAttribute( column, subelement, "nullable" );
        copyBooleanAttribute( column, subelement, "insertable" );
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

   * element-collection, many-to-many, or one-to-many associations.
   */
  private void getMapKeyEnumerated(List<Annotation> annotationList, Element element) {
    Element subelement = element != null ? element.element( "map-key-enumerated" ) : null;
    if ( subelement != null ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyEnumerated.class );
      EnumType value = EnumType.valueOf( subelement.getTextTrim() );
      ad.setValue( "value", value );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

   * many-to-many, or one-to-many associations.
   */
  private void getMapKeyTemporal(List<Annotation> annotationList, Element element) {
    Element subelement = element != null ? element.element( "map-key-temporal" ) : null;
    if ( subelement != null ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyTemporal.class );
      TemporalType value = TemporalType.valueOf( subelement.getTextTrim() );
      ad.setValue( "value", value );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

   * many-to-many, or one-to-many associations.
   */
  private void getOrderColumn(List<Annotation> annotationList, Element element) {
    Element subelement = element != null ? element.element( "order-column" ) : null;
    if ( subelement != null ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( OrderColumn.class );
      copyStringAttribute( ad, subelement, "name", false );
      copyBooleanAttribute( ad, subelement, "nullable" );
      copyBooleanAttribute( ad, subelement, "insertable" );
      copyBooleanAttribute( ad, subelement, "updatable" );
      copyStringAttribute( ad, subelement, "column-definition", false );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.