Search in sources :

Example 1 with JaxbMapKeyJoinColumn

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

the class JPAXMLOverriddenAnnotationReader method buildMapKeyJoinColumns.

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

Example 2 with JaxbMapKeyJoinColumn

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

the class JPAXMLOverriddenAnnotationReader method getMapKeyJoinColumns.

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

Aggregations

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