Search in sources :

Example 1 with JaxbUniqueConstraint

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

the class JPAXMLOverriddenAnnotationReader method buildUniqueConstraints.

private static void buildUniqueConstraints(AnnotationDescriptor annotation, List<JaxbUniqueConstraint> elements) {
    UniqueConstraint[] uniqueConstraints = new UniqueConstraint[elements.size()];
    int i = 0;
    for (JaxbUniqueConstraint element : elements) {
        String[] columnNames = element.getColumnName().toArray(new String[0]);
        AnnotationDescriptor ucAnn = new AnnotationDescriptor(UniqueConstraint.class);
        copyAttribute(ucAnn, "name", element.getName(), false);
        ucAnn.setValue("columnNames", columnNames);
        uniqueConstraints[i++] = AnnotationFactory.create(ucAnn);
    }
    annotation.setValue("uniqueConstraints", uniqueConstraints);
}
Also used : AnnotationDescriptor(org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor) JaxbUniqueConstraint(org.hibernate.boot.jaxb.mapping.spi.JaxbUniqueConstraint) JaxbUniqueConstraint(org.hibernate.boot.jaxb.mapping.spi.JaxbUniqueConstraint) UniqueConstraint(jakarta.persistence.UniqueConstraint) JaxbUniqueConstraint(org.hibernate.boot.jaxb.mapping.spi.JaxbUniqueConstraint) QueryHint(jakarta.persistence.QueryHint) JaxbQueryHint(org.hibernate.boot.jaxb.mapping.spi.JaxbQueryHint) UniqueConstraint(jakarta.persistence.UniqueConstraint)

Aggregations

QueryHint (jakarta.persistence.QueryHint)1 UniqueConstraint (jakarta.persistence.UniqueConstraint)1 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)1 JaxbQueryHint (org.hibernate.boot.jaxb.mapping.spi.JaxbQueryHint)1 JaxbUniqueConstraint (org.hibernate.boot.jaxb.mapping.spi.JaxbUniqueConstraint)1