Search in sources :

Example 1 with JaxbDiscriminatorColumn

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

the class JPAXMLOverriddenAnnotationReader method getDiscriminatorColumn.

private DiscriminatorColumn getDiscriminatorColumn(ManagedType root, XMLContext.Default defaults) {
    JaxbDiscriminatorColumn element = root instanceof JaxbEntity ? ((JaxbEntity) root).getDiscriminatorColumn() : null;
    if (element != null) {
        AnnotationDescriptor ad = new AnnotationDescriptor(DiscriminatorColumn.class);
        copyAttribute(ad, "name", element.getName(), false);
        copyAttribute(ad, "column-definition", element.getColumnDefinition(), false);
        DiscriminatorType type = element.getDiscriminatorType();
        if (type != null) {
            ad.setValue("discriminatorType", type);
        }
        copyAttribute(ad, "length", element.getLength(), false);
        return AnnotationFactory.create(ad);
    } else if (defaults.canUseJavaAnnotations()) {
        return getPhysicalAnnotation(DiscriminatorColumn.class);
    } else {
        return null;
    }
}
Also used : AnnotationDescriptor(org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor) JaxbDiscriminatorColumn(org.hibernate.boot.jaxb.mapping.spi.JaxbDiscriminatorColumn) DiscriminatorType(jakarta.persistence.DiscriminatorType) JaxbDiscriminatorColumn(org.hibernate.boot.jaxb.mapping.spi.JaxbDiscriminatorColumn) DiscriminatorColumn(jakarta.persistence.DiscriminatorColumn) JaxbEntity(org.hibernate.boot.jaxb.mapping.spi.JaxbEntity)

Aggregations

DiscriminatorColumn (jakarta.persistence.DiscriminatorColumn)1 DiscriminatorType (jakarta.persistence.DiscriminatorType)1 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)1 JaxbDiscriminatorColumn (org.hibernate.boot.jaxb.mapping.spi.JaxbDiscriminatorColumn)1 JaxbEntity (org.hibernate.boot.jaxb.mapping.spi.JaxbEntity)1