org.hibernate.annotations.FetchProfile Java Examples
The following examples show how to use
org.hibernate.annotations.FetchProfile.
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: VerifyFetchProfileReferenceSecondPass.java From lams with GNU General Public License v2.0 | 6 votes |
public void doSecondPass(Map persistentClasses) throws MappingException { org.hibernate.mapping.FetchProfile profile = buildingContext.getMetadataCollector().getFetchProfile( fetchProfileName ); if ( profile != null ) { if ( profile.getSource() != MetadataSource.ANNOTATIONS ) { return; } } else { profile = new org.hibernate.mapping.FetchProfile( fetchProfileName, MetadataSource.ANNOTATIONS ); buildingContext.getMetadataCollector().addFetchProfile( profile ); } PersistentClass clazz = buildingContext.getMetadataCollector().getEntityBinding( fetch.entity().getName() ); // throws MappingException in case the property does not exist clazz.getProperty( fetch.association() ); profile.addFetch( fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase(Locale.ROOT) ); }
Example #2
Source File: AnnotationBinder.java From lams with GNU General Public License v2.0 | 6 votes |
private static void bindFetchProfile(FetchProfile fetchProfileAnnotation, MetadataBuildingContext context) { for ( FetchProfile.FetchOverride fetch : fetchProfileAnnotation.fetchOverrides() ) { org.hibernate.annotations.FetchMode mode = fetch.mode(); if ( !mode.equals( org.hibernate.annotations.FetchMode.JOIN ) ) { throw new MappingException( "Only FetchMode.JOIN is currently supported" ); } context.getMetadataCollector().addSecondPass( new VerifyFetchProfileReferenceSecondPass( fetchProfileAnnotation.name(), fetch, context ) ); } }
Example #3
Source File: VerifyFetchProfileReferenceSecondPass.java From lams with GNU General Public License v2.0 | 5 votes |
public VerifyFetchProfileReferenceSecondPass( String fetchProfileName, FetchProfile.FetchOverride fetch, MetadataBuildingContext buildingContext) { this.fetchProfileName = fetchProfileName; this.fetch = fetch; this.buildingContext = buildingContext; }
Example #4
Source File: AnnotationBinder.java From lams with GNU General Public License v2.0 | 5 votes |
private static void bindFetchProfiles(XAnnotatedElement annotatedElement, MetadataBuildingContext context) { FetchProfile fetchProfileAnnotation = annotatedElement.getAnnotation( FetchProfile.class ); FetchProfiles fetchProfileAnnotations = annotatedElement.getAnnotation( FetchProfiles.class ); if ( fetchProfileAnnotation != null ) { bindFetchProfile( fetchProfileAnnotation, context ); } if ( fetchProfileAnnotations != null ) { for ( FetchProfile profile : fetchProfileAnnotations.value() ) { bindFetchProfile( profile, context ); } } }