微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.persistence.NamedEntityGraph的实例源码

项目:lams    文件JPAOverriddenAnnotationReader.java   
public static List<NamedEntityGraph> buildNamedEntityGraph(Element element,XMLContext.Default defaults) {
    if ( element == null ) {
        return new ArrayList<NamedEntityGraph>();
    }
    List<NamedEntityGraph> namedEntityGraphList = new ArrayList<NamedEntityGraph>();
    List<Element> namedEntityGraphElements = element.elements( "named-entity-graph" );
    for ( Element subElement : namedEntityGraphElements ) {
        AnnotationDescriptor ann = new AnnotationDescriptor( NamedEntityGraph.class );
        copyStringAttribute( ann,subElement,"name",false );
        copyBooleanAttribute( ann,"include-all-attributes" );
        bindNamedAttributeNodes( subElement,ann );

        List<Element> subgraphNodes = subElement.elements( "subgraph" );
        bindNamedSubgraph( defaults,ann,subgraphNodes );
        List<Element> subclassSubgraphNodes = subElement.elements( "subclass-subgraph" );
        bindNamedSubgraph( defaults,subclassSubgraphNodes );
        namedEntityGraphList.add( (NamedEntityGraph) AnnotationFactory.create( ann ) );
    }
    //Todo
    return namedEntityGraphList;
}
项目:lams    文件JPAOverriddenAnnotationReader.java   
private NamedEntityGraphs getNamedEntityGraphs(Element tree,XMLContext.Default defaults) {
    List<NamedEntityGraph> queries = buildNamedEntityGraph( tree,defaults );
    if ( defaults.canUseJavaAnnotations() ) {
        NamedEntityGraph annotation = getPhysicalAnnotation( NamedEntityGraph.class );
        addNamedEntityGraphIfNeeded( annotation,queries );
        NamedEntityGraphs annotations = getPhysicalAnnotation( NamedEntityGraphs.class );
        if ( annotations != null ) {
            for ( NamedEntityGraph current : annotations.value() ) {
                addNamedEntityGraphIfNeeded( current,queries );
            }
        }
    }
    if ( queries.size() > 0 ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( NamedEntityGraphs.class );
        ad.setValue( "value",queries.toArray( new NamedEntityGraph[queries.size()] ) );
        return AnnotationFactory.create( ad );
    }
    else {
        return null;
    }
}
项目:lams    文件JPAOverriddenAnnotationReader.java   
private void addNamedEntityGraphIfNeeded(NamedEntityGraph annotation,List<NamedEntityGraph> queries) {
    if ( annotation != null ) {
        String queryName = annotation.name();
        boolean present = false;
        for ( NamedEntityGraph current : queries ) {
            if ( current.name().equals( queryName ) ) {
                present = true;
                break;
            }
        }
        if ( !present ) {
            queries.add( annotation );
        }
    }

}
项目:lams    文件NamedEntityGraphDeFinition.java   
public NamedEntityGraphDeFinition(NamedEntityGraph annotation,String jpaEntityName,String entityName) {
    this.annotation = annotation;
    this.jpaEntityName = jpaEntityName;
    this.entityName = entityName;
    this.name = StringHelper.isNotEmpty( annotation.name() )
            ? annotation.name()
            : jpaEntityName;
    if ( name == null ) {
        throw new IllegalArgumentException( "Named entity graph name cannot be null" );
    }
}
项目:lams    文件EntityBinder.java   
private void processNamedEntityGraphs() {
    processNamedEntityGraph( annotatedClass.getAnnotation( NamedEntityGraph.class ) );
    final NamedEntityGraphs graphs = annotatedClass.getAnnotation( NamedEntityGraphs.class );
    if ( graphs != null ) {
        for ( NamedEntityGraph graph : graphs.value() ) {
            processNamedEntityGraph( graph );
        }
    }
}
项目:lams    文件NamedEntityGraphDeFinition.java   
public NamedEntityGraph getAnnotation() {
    return annotation;
}
项目:lams    文件EntityBinder.java   
private void processNamedEntityGraph(NamedEntityGraph annotation) {
    if ( annotation == null ) {
        return;
    }
    mappings.addNamedEntityGraphDefintion( new NamedEntityGraphDeFinition( annotation,name,persistentClass.getEntityName() ) );
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。