下面列出了org.hibernate.type.AssociationType#isEntityType ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* 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;
}
}
}
/**
* 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;
}
}
}
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();
}
}
@Override
protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) {
return ( type.isEntityType() || type.isCollectionType() ) &&
( cascadeStyle == null || cascadeStyle.doCascade( cascadeAction ) );
}
protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) {
return ( type.isEntityType() || type.isCollectionType() ) &&
( cascadeStyle==null || cascadeStyle.doCascade(cascadeAction) );
}
/**
* 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 );
}
/**
* 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) ;
}