本文整理汇总了Java中javax.persistence.NamedEntityGraph类的典型用法代码示例。如果您正苦于以下问题:Java NamedEntityGraph类的具体用法?Java NamedEntityGraph怎么用?Java NamedEntityGraph使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NamedEntityGraph类属于javax.persistence包,在下文中一共展示了NamedEntityGraph类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildNamedEntityGraph
import javax.persistence.NamedEntityGraph; //导入依赖的package包/类
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, subElement, "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, ann, subclassSubgraphNodes );
namedEntityGraphList.add( (NamedEntityGraph) AnnotationFactory.create( ann ) );
}
//TODO
return namedEntityGraphList;
}
示例2: getNamedEntityGraphs
import javax.persistence.NamedEntityGraph; //导入依赖的package包/类
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;
}
}
示例3: addNamedEntityGraphIfNeeded
import javax.persistence.NamedEntityGraph; //导入依赖的package包/类
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 );
}
}
}
示例4: NamedEntityGraphDefinition
import javax.persistence.NamedEntityGraph; //导入依赖的package包/类
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" );
}
}
示例5: processNamedEntityGraphs
import javax.persistence.NamedEntityGraph; //导入依赖的package包/类
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 );
}
}
}
示例6: getAnnotation
import javax.persistence.NamedEntityGraph; //导入依赖的package包/类
public NamedEntityGraph getAnnotation() {
return annotation;
}
示例7: processNamedEntityGraph
import javax.persistence.NamedEntityGraph; //导入依赖的package包/类
private void processNamedEntityGraph(NamedEntityGraph annotation) {
if ( annotation == null ) {
return;
}
mappings.addNamedEntityGraphDefintion( new NamedEntityGraphDefinition( annotation, name, persistentClass.getEntityName() ) );
}