Package org.hibernate.annotations.common.annotationfactory

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


      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

  }

  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

  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

   * 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

   * 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

   * 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

   * associations.
   */
  private void getMapsId(List<Annotation> annotationList, Element element) {
    String attrVal = element.attributeValue( "maps-id" );
    if ( attrVal != null ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( MapsId.class );
      ad.setValue( "value", attrVal );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here

   * associations.
   */
  private void getAssociationId(List<Annotation> annotationList, Element element) {
    String attrVal = element.attributeValue( "id" );
    if ( "true".equals( attrVal ) ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( Id.class );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here

   * context.
   */
  private void getElementCollection(List<Annotation> annotationList, XMLContext.Default defaults) {
    for ( Element element : elementsForProperty ) {
      if ( "element-collection".equals( element.getName() ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( ElementCollection.class );
        addTargetClass( element, ad, "target-class", defaults );
        getFetchType( ad, element );
        getOrderBy( annotationList, element );
        getOrderColumn( annotationList, element );
        getMapKey( annotationList, element );
View Full Code Here

TOP

Related Classes of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

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.