Search in sources :

Example 1 with JaxbQueryHint

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

the class JPAXMLOverriddenAnnotationReader method buildQueryHints.

private static void buildQueryHints(List<JaxbQueryHint> elements, AnnotationDescriptor ann) {
    List<QueryHint> queryHints = new ArrayList<>(elements.size());
    for (JaxbQueryHint hint : elements) {
        AnnotationDescriptor hintDescriptor = new AnnotationDescriptor(QueryHint.class);
        String value = hint.getName();
        if (value == null) {
            throw new AnnotationException("<hint> without name. " + SCHEMA_VALIDATION);
        }
        hintDescriptor.setValue("name", value);
        value = hint.getValue();
        if (value == null) {
            throw new AnnotationException("<hint> without value. " + SCHEMA_VALIDATION);
        }
        hintDescriptor.setValue("value", value);
        queryHints.add(AnnotationFactory.create(hintDescriptor));
    }
    ann.setValue("hints", queryHints.toArray(new QueryHint[queryHints.size()]));
}
Also used : AnnotationDescriptor(org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor) JaxbQueryHint(org.hibernate.boot.jaxb.mapping.spi.JaxbQueryHint) QueryHint(jakarta.persistence.QueryHint) JaxbQueryHint(org.hibernate.boot.jaxb.mapping.spi.JaxbQueryHint) ArrayList(java.util.ArrayList) AnnotationException(org.hibernate.AnnotationException)

Aggregations

QueryHint (jakarta.persistence.QueryHint)1 ArrayList (java.util.ArrayList)1 AnnotationException (org.hibernate.AnnotationException)1 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)1 JaxbQueryHint (org.hibernate.boot.jaxb.mapping.spi.JaxbQueryHint)1