use of org.hibernate.boot.jaxb.mapping.spi.JaxbNamedNativeQuery in project hibernate-orm by hibernate.
the class JPAXMLOverriddenAnnotationReader method buildNamedNativeQueries.
public static List<NamedNativeQuery> buildNamedNativeQueries(List<JaxbNamedNativeQuery> elements, XMLContext.Default defaults, ClassLoaderAccess classLoaderAccess) {
List<NamedNativeQuery> namedQueries = new ArrayList<>();
for (JaxbNamedNativeQuery element : elements) {
AnnotationDescriptor ann = new AnnotationDescriptor(NamedNativeQuery.class);
copyAttribute(ann, "name", element.getName(), false);
copyAttribute(ann, "query", element.getQuery(), true);
buildQueryHints(element.getHint(), ann);
String clazzName = element.getResultClass();
if (StringHelper.isNotEmpty(clazzName)) {
Class clazz;
try {
clazz = classLoaderAccess.classForName(XMLContext.buildSafeClassName(clazzName, defaults));
} catch (ClassLoadingException e) {
throw new AnnotationException("Unable to find entity-class: " + clazzName, e);
}
ann.setValue("resultClass", clazz);
}
copyAttribute(ann, "result-set-mapping", element.getResultSetMapping(), false);
namedQueries.add(AnnotationFactory.create(ann));
}
return namedQueries;
}
Aggregations