Search in sources :

Example 1 with JaxbJoinColumn

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

the class JPAXMLOverriddenAnnotationReader method buildJoinColumns.

private void buildJoinColumns(List<Annotation> annotationList, List<JaxbJoinColumn> elements) {
    JoinColumn[] joinColumns = getJoinColumns(elements, false);
    if (joinColumns.length > 0) {
        AnnotationDescriptor ad = new AnnotationDescriptor(JoinColumns.class);
        ad.setValue("value", joinColumns);
        annotationList.add(AnnotationFactory.create(ad));
    }
}
Also used : AnnotationDescriptor(org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor) JaxbPrimaryKeyJoinColumn(org.hibernate.boot.jaxb.mapping.spi.JaxbPrimaryKeyJoinColumn) JaxbMapKeyJoinColumn(org.hibernate.boot.jaxb.mapping.spi.JaxbMapKeyJoinColumn) PrimaryKeyJoinColumn(jakarta.persistence.PrimaryKeyJoinColumn) MapKeyJoinColumn(jakarta.persistence.MapKeyJoinColumn) JoinColumn(jakarta.persistence.JoinColumn) JaxbJoinColumn(org.hibernate.boot.jaxb.mapping.spi.JaxbJoinColumn)

Example 2 with JaxbJoinColumn

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

the class JPAXMLOverriddenAnnotationReader method getJoinColumns.

private JoinColumn[] getJoinColumns(List<JaxbJoinColumn> subelements, boolean isInverse) {
    List<JoinColumn> joinColumns = new ArrayList<>();
    if (subelements != null) {
        for (JaxbJoinColumn subelement : subelements) {
            AnnotationDescriptor column = new AnnotationDescriptor(JoinColumn.class);
            copyAttribute(column, "name", subelement.getName(), false);
            copyAttribute(column, "referenced-column-name", subelement.getReferencedColumnName(), false);
            copyAttribute(column, "unique", subelement.isUnique(), false);
            copyAttribute(column, "nullable", subelement.isNullable(), false);
            copyAttribute(column, "insertable", subelement.isInsertable(), false);
            copyAttribute(column, "updatable", subelement.isUpdatable(), false);
            copyAttribute(column, "column-definition", subelement.getColumnDefinition(), false);
            copyAttribute(column, "table", subelement.getTable(), false);
            joinColumns.add(AnnotationFactory.create(column));
        }
    }
    return joinColumns.toArray(new JoinColumn[joinColumns.size()]);
}
Also used : AnnotationDescriptor(org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor) JaxbPrimaryKeyJoinColumn(org.hibernate.boot.jaxb.mapping.spi.JaxbPrimaryKeyJoinColumn) JaxbMapKeyJoinColumn(org.hibernate.boot.jaxb.mapping.spi.JaxbMapKeyJoinColumn) PrimaryKeyJoinColumn(jakarta.persistence.PrimaryKeyJoinColumn) MapKeyJoinColumn(jakarta.persistence.MapKeyJoinColumn) JoinColumn(jakarta.persistence.JoinColumn) JaxbJoinColumn(org.hibernate.boot.jaxb.mapping.spi.JaxbJoinColumn) JaxbJoinColumn(org.hibernate.boot.jaxb.mapping.spi.JaxbJoinColumn) ArrayList(java.util.ArrayList)

Aggregations

JoinColumn (jakarta.persistence.JoinColumn)2 MapKeyJoinColumn (jakarta.persistence.MapKeyJoinColumn)2 PrimaryKeyJoinColumn (jakarta.persistence.PrimaryKeyJoinColumn)2 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)2 JaxbJoinColumn (org.hibernate.boot.jaxb.mapping.spi.JaxbJoinColumn)2 JaxbMapKeyJoinColumn (org.hibernate.boot.jaxb.mapping.spi.JaxbMapKeyJoinColumn)2 JaxbPrimaryKeyJoinColumn (org.hibernate.boot.jaxb.mapping.spi.JaxbPrimaryKeyJoinColumn)2 ArrayList (java.util.ArrayList)1