private SqlResultSetMappings getSqlResultSetMappings(Element tree, XMLContext.Default defaults) { List<SqlResultSetMapping> results = buildSqlResultsetMappings( tree, defaults ); 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; } }
public static void bindSqlResultsetMappings(SqlResultSetMappings ann, Mappings mappings, boolean isDefault) { if ( ann == null ) return; for (SqlResultSetMapping rs : ann.value()) { //no need to handle inSecondPass mappings.addSecondPass( new ResultsetMappingSecondPass( rs, mappings, true ) ); } }
public XAnnotation<?> createSqlResultSetMapping( Collection<SqlResultSetMapping> cSqlResultSetMappings) { return transform( SqlResultSetMappings.class, javax.persistence.SqlResultSetMapping.class, cSqlResultSetMappings, new Transformer<SqlResultSetMapping, XAnnotation<javax.persistence.SqlResultSetMapping>>() { public XAnnotation<javax.persistence.SqlResultSetMapping> transform( SqlResultSetMapping input) { return createSqlResultSetMapping(input); } }); }