Search in sources :

Example 1 with SqlResultSetMappings

use of javax.persistence.SqlResultSetMappings in project hibernate-orm by hibernate.

the class JPAOverriddenAnnotationReader method getSqlResultSetMappings.

private SqlResultSetMappings getSqlResultSetMappings(Element tree, XMLContext.Default defaults) {
    List<SqlResultSetMapping> results = buildSqlResultsetMappings(tree, defaults, classLoaderAccess);
    if (defaults.canUseJavaAnnotations()) {
        SqlResultSetMapping annotation = getPhysicalAnnotation(SqlResultSetMapping.class);
        addSqlResultsetMappingIfNeeded(annotation, results);
        SqlResultSetMappings annotations = getPhysicalAnnotation(SqlResultSetMappings.class);
        if (annotations != null) {
            for (SqlResultSetMapping current : annotations.value()) {
                addSqlResultsetMappingIfNeeded(current, results);
            }
        }
    }
    if (results.size() > 0) {
        AnnotationDescriptor ad = new AnnotationDescriptor(SqlResultSetMappings.class);
        ad.setValue("value", results.toArray(new SqlResultSetMapping[results.size()]));
        return AnnotationFactory.create(ad);
    } else {
        return null;
    }
}
Also used : AnnotationDescriptor(org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor) SqlResultSetMappings(javax.persistence.SqlResultSetMappings) SqlResultSetMapping(javax.persistence.SqlResultSetMapping)

Aggregations

SqlResultSetMapping (javax.persistence.SqlResultSetMapping)1 SqlResultSetMappings (javax.persistence.SqlResultSetMappings)1 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)1