javax.persistence.NamedEntityGraphs Java Examples

The following examples show how to use javax.persistence.NamedEntityGraphs. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JPAOverriddenAnnotationReader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private NamedEntityGraphs getNamedEntityGraphs(Element tree, XMLContext.Default defaults) {
	List<NamedEntityGraph> queries = buildNamedEntityGraph( tree, defaults, classLoaderAccess );
	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;
	}
}
 
Example #2
Source File: EntityBinder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
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 );
		}
	}
}