Java 类javax.persistence.SqlResultSetMapping 实例源码

项目:lams    文件:JPAOverriddenAnnotationReader.java   
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;
    }
}
项目:lams    文件:JPAOverriddenAnnotationReader.java   
private void addSqlResultsetMappingIfNeeded(SqlResultSetMapping annotation, List<SqlResultSetMapping> resultsets) {
    if ( annotation != null ) {
        String resultsetName = annotation.name();
        boolean present = false;
        for ( SqlResultSetMapping current : resultsets ) {
            if ( current.name().equals( resultsetName ) ) {
                present = true;
                break;
            }
        }
        if ( !present ) {
            resultsets.add( annotation );
        }
    }
}
项目:lams    文件:QueryBinder.java   
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 ) );
    }
}
项目:lams    文件:ResultsetMappingSecondPass.java   
public ResultsetMappingSecondPass(SqlResultSetMapping ann, Mappings mappings, boolean isDefault) {
    this.ann = ann;
    this.mappings = mappings;
    this.isDefault = isDefault;
}
项目:lams    文件:QueryBinder.java   
public static void bindSqlResultsetMapping(SqlResultSetMapping ann, Mappings mappings, boolean isDefault) {
    //no need to handle inSecondPass
    mappings.addSecondPass( new ResultsetMappingSecondPass( ann, mappings, isDefault ) );
}