Search in sources :

Example 1 with JaxbManyToMany

use of org.hibernate.boot.jaxb.mapping.spi.JaxbManyToMany in project hibernate-orm by hibernate.

the class JPAXMLOverriddenAnnotationReader method getManyToMany.

/**
 * @see #getOneToOne(List, XMLContext.Default)
 * @see #getElementCollection(List, XMLContext.Default)
 */
private void getManyToMany(List<Annotation> annotationList, XMLContext.Default defaults) {
    Class<ManyToMany> annotationType = ManyToMany.class;
    List<JaxbManyToMany> elements = elementsForProperty.getManyToMany();
    for (JaxbManyToMany element : elements) {
        AnnotationDescriptor ad = new AnnotationDescriptor(annotationType);
        addTargetClass(element.getTargetEntity(), ad, "target-entity", defaults);
        getFetchType(ad, element.getFetch());
        getCascades(ad, element.getCascade(), defaults);
        getJoinTable(annotationList, element, defaults);
        copyAttribute(ad, "mapped-by", element.getMappedBy(), false);
        annotationList.add(AnnotationFactory.create(ad));
        getOrderBy(annotationList, element.getOrderBy());
        getMapKey(annotationList, element.getMapKey());
        getMapKeyClass(annotationList, element.getMapKeyClass(), defaults);
        getMapKeyColumn(annotationList, element.getMapKeyColumn());
        getOrderColumn(annotationList, element.getOrderColumn());
        getMapKeyTemporal(annotationList, element.getMapKeyTemporal());
        getMapKeyEnumerated(annotationList, element.getMapKeyEnumerated());
        Annotation annotation = getMapKeyAttributeOverrides(element.getMapKeyAttributeOverride(), defaults);
        addIfNotNull(annotationList, annotation);
        getMapKeyJoinColumns(annotationList, element.getMapKeyJoinColumn());
        getAccessType(annotationList, element.getAccess());
    }
    afterGetAssociation(annotationType, annotationList, defaults);
}
Also used : AnnotationDescriptor(org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor) ManyToMany(jakarta.persistence.ManyToMany) JaxbManyToMany(org.hibernate.boot.jaxb.mapping.spi.JaxbManyToMany) JaxbManyToMany(org.hibernate.boot.jaxb.mapping.spi.JaxbManyToMany) Annotation(java.lang.annotation.Annotation)

Aggregations

ManyToMany (jakarta.persistence.ManyToMany)1 Annotation (java.lang.annotation.Annotation)1 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)1 JaxbManyToMany (org.hibernate.boot.jaxb.mapping.spi.JaxbManyToMany)1