use of javax.persistence.NamedNativeQuery in project hibernate-orm by hibernate.
the class JPAOverriddenAnnotationReader method addNamedNativeQueryIfNeeded.
private void addNamedNativeQueryIfNeeded(NamedNativeQuery annotation, List<NamedNativeQuery> queries) {
if (annotation != null) {
String queryName = annotation.name();
boolean present = false;
for (NamedNativeQuery current : queries) {
if (current.name().equals(queryName)) {
present = true;
break;
}
}
if (!present) {
queries.add(annotation);
}
}
}
use of javax.persistence.NamedNativeQuery in project hibernate-orm by hibernate.
the class JPAOverriddenAnnotationReader method getNamedNativeQueries.
private NamedNativeQueries getNamedNativeQueries(Element tree, XMLContext.Default defaults) {
List<NamedNativeQuery> queries = (List<NamedNativeQuery>) buildNamedQueries(tree, true, defaults, classLoaderAccess);
if (defaults.canUseJavaAnnotations()) {
NamedNativeQuery annotation = getPhysicalAnnotation(NamedNativeQuery.class);
addNamedNativeQueryIfNeeded(annotation, queries);
NamedNativeQueries annotations = getPhysicalAnnotation(NamedNativeQueries.class);
if (annotations != null) {
for (NamedNativeQuery current : annotations.value()) {
addNamedNativeQueryIfNeeded(current, queries);
}
}
}
if (queries.size() > 0) {
AnnotationDescriptor ad = new AnnotationDescriptor(NamedNativeQueries.class);
ad.setValue("value", queries.toArray(new NamedNativeQuery[queries.size()]));
return AnnotationFactory.create(ad);
} else {
return null;
}
}
Aggregations