Search in sources :

Example 1 with NamedStoredProcedureQueries

use of jakarta.persistence.NamedStoredProcedureQueries in project hibernate-orm by hibernate.

the class JPAXMLOverriddenAnnotationReader method getNamedStoredProcedureQueries.

private NamedStoredProcedureQueries getNamedStoredProcedureQueries(ManagedType root, XMLContext.Default defaults) {
    List<NamedStoredProcedureQuery> queries = root instanceof JaxbEntity ? buildNamedStoreProcedureQueries(((JaxbEntity) root).getNamedStoredProcedureQuery(), defaults, classLoaderAccess) : new ArrayList<>();
    if (defaults.canUseJavaAnnotations()) {
        NamedStoredProcedureQuery annotation = getPhysicalAnnotation(NamedStoredProcedureQuery.class);
        addNamedStoredProcedureQueryIfNeeded(annotation, queries);
        NamedStoredProcedureQueries annotations = getPhysicalAnnotation(NamedStoredProcedureQueries.class);
        if (annotations != null) {
            for (NamedStoredProcedureQuery current : annotations.value()) {
                addNamedStoredProcedureQueryIfNeeded(current, queries);
            }
        }
    }
    if (queries.size() > 0) {
        AnnotationDescriptor ad = new AnnotationDescriptor(NamedStoredProcedureQueries.class);
        ad.setValue("value", queries.toArray(new NamedStoredProcedureQuery[queries.size()]));
        return AnnotationFactory.create(ad);
    } else {
        return null;
    }
}
Also used : AnnotationDescriptor(org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor) NamedStoredProcedureQueries(jakarta.persistence.NamedStoredProcedureQueries) JaxbNamedStoredProcedureQuery(org.hibernate.boot.jaxb.mapping.spi.JaxbNamedStoredProcedureQuery) NamedStoredProcedureQuery(jakarta.persistence.NamedStoredProcedureQuery) JaxbEntity(org.hibernate.boot.jaxb.mapping.spi.JaxbEntity)

Aggregations

NamedStoredProcedureQueries (jakarta.persistence.NamedStoredProcedureQueries)1 NamedStoredProcedureQuery (jakarta.persistence.NamedStoredProcedureQuery)1 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)1 JaxbEntity (org.hibernate.boot.jaxb.mapping.spi.JaxbEntity)1 JaxbNamedStoredProcedureQuery (org.hibernate.boot.jaxb.mapping.spi.JaxbNamedStoredProcedureQuery)1