Java Code Examples for org.hibernate.type.AssociationType#isEntityType()

The following examples show how to use org.hibernate.type.AssociationType#isEntityType() . 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: JoinWalker.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Does the mapping, and Hibernate default semantics, specify that
 * this association should be fetched by outer joining
 */
protected boolean isJoinedFetchEnabledInMapping(FetchMode config, AssociationType type)
		throws MappingException {
	if ( !type.isEntityType() && !type.isCollectionType() ) {
		return false;
	}
	else {
		if ( config == FetchMode.JOIN ) {
			return true;
		}
		if ( config == FetchMode.SELECT ) {
			return false;
		}
		if ( type.isEntityType() ) {
			//TODO: look at the owning property and check that it 
			//      isn't lazy (by instrumentation)
			EntityType entityType = (EntityType) type;
			EntityPersister persister = getFactory().getEntityPersister( entityType.getAssociatedEntityName() );
			return !persister.hasProxy();
		}
		else {
			return false;
		}
	}
}
 
Example 2
Source File: JoinWalker.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Does the mapping, and Hibernate default semantics, specify that
 * this association should be fetched by outer joining
 */
protected boolean isJoinedFetchEnabledInMapping(FetchMode config, AssociationType type) 
throws MappingException {
	if ( !type.isEntityType() && !type.isCollectionType() ) {
		return false;
	}
	else {
		if (config==FetchMode.JOIN) return true;
		if (config==FetchMode.SELECT) return false;
		if ( type.isEntityType() ) {
			//TODO: look at the owning property and check that it 
			//      isn't lazy (by instrumentation)
			EntityType entityType =(EntityType) type;
			EntityPersister persister = getFactory().getEntityPersister( entityType.getAssociatedEntityName() );
			return !persister.hasProxy();
		}
		else {
			return false;
		}
	}
}
 
Example 3
Source File: FetchStrategyHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static boolean isSubsequentSelectDelayed(AssociationType type, SessionFactoryImplementor sessionFactory) {
	if ( type.isAnyType() ) {
		// we'd need more context here.  this is only kept as part of the property state on the owning entity
		return false;
	}
	else if ( type.isEntityType() ) {
		return ( (EntityPersister) type.getAssociatedJoinable( sessionFactory ) ).hasProxy();
	}
	else {
		final CollectionPersister cp = ( (CollectionPersister) type.getAssociatedJoinable( sessionFactory ) );
		return cp.isLazy() || cp.isExtraLazy();
	}
}
 
Example 4
Source File: CascadeEntityJoinWalker.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) {
	return ( type.isEntityType() || type.isCollectionType() ) &&
			( cascadeStyle == null || cascadeStyle.doCascade( cascadeAction ) );
}
 
Example 5
Source File: CascadeEntityJoinWalker.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) {
	return ( type.isEntityType() || type.isCollectionType() ) &&
			( cascadeStyle==null || cascadeStyle.doCascade(cascadeAction) );
}
 
Example 6
Source File: JoinWalker.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Override on subclasses to enable or suppress joining
 * of certain association types
 */
protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) {
	return type.isEntityType() && isJoinedFetchEnabledInMapping( config, type );
}
 
Example 7
Source File: JoinWalker.java    From cacheonix-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Override on subclasses to enable or suppress joining 
 * of certain association types
 */
protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) {
	return type.isEntityType() && isJoinedFetchEnabledInMapping(config, type) ;
}