Search in sources :

Example 1 with JaxbMapKeyClass

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

the class JPAXMLOverriddenAnnotationReader method getMapKeyClass.

private void getMapKeyClass(List<Annotation> annotationList, JaxbMapKeyClass element, XMLContext.Default defaults) {
    String nodeName = "map-key-class";
    if (element != null) {
        String mapKeyClassName = element.getClazz();
        AnnotationDescriptor ad = new AnnotationDescriptor(MapKeyClass.class);
        if (StringHelper.isNotEmpty(mapKeyClassName)) {
            Class clazz;
            try {
                clazz = classLoaderAccess.classForName(XMLContext.buildSafeClassName(mapKeyClassName, defaults));
            } catch (ClassLoadingException e) {
                throw new AnnotationException("Unable to find " + nodeName + ": " + mapKeyClassName, e);
            }
            ad.setValue("value", clazz);
        }
        annotationList.add(AnnotationFactory.create(ad));
    }
}
Also used : AnnotationDescriptor(org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor) ClassLoadingException(org.hibernate.boot.registry.classloading.spi.ClassLoadingException) AnnotationException(org.hibernate.AnnotationException) IdClass(jakarta.persistence.IdClass) MapKeyClass(jakarta.persistence.MapKeyClass) JaxbIdClass(org.hibernate.boot.jaxb.mapping.spi.JaxbIdClass) JaxbMapKeyClass(org.hibernate.boot.jaxb.mapping.spi.JaxbMapKeyClass)

Aggregations

IdClass (jakarta.persistence.IdClass)1 MapKeyClass (jakarta.persistence.MapKeyClass)1 AnnotationException (org.hibernate.AnnotationException)1 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)1 JaxbIdClass (org.hibernate.boot.jaxb.mapping.spi.JaxbIdClass)1 JaxbMapKeyClass (org.hibernate.boot.jaxb.mapping.spi.JaxbMapKeyClass)1 ClassLoadingException (org.hibernate.boot.registry.classloading.spi.ClassLoadingException)1