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

The following examples show how to use org.hibernate.type.AssociationType#isAnyType() . 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: 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 2
Source File: EntityBasedAssociationAttribute.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public AssociationKey getAssociationKey() {
	final AssociationType type = getType();

	if ( type.isAnyType() ) {
		return new AssociationKey(
				JoinHelper.getLHSTableName( type, attributeNumber(), (OuterJoinLoadable) getSource() ),
				JoinHelper.getLHSColumnNames(
						type,
						attributeNumber(),
						0,
						(OuterJoinLoadable) getSource(),
						sessionFactory()
				)
		);
	}

	final Joinable joinable = type.getAssociatedJoinable( sessionFactory() );

	if ( type.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) {
		final String lhsTableName;
		final String[] lhsColumnNames;

		if ( joinable.isCollection() ) {
			final QueryableCollection collectionPersister = (QueryableCollection) joinable;
			lhsTableName = collectionPersister.getTableName();
			lhsColumnNames = collectionPersister.getElementColumnNames();
		}
		else {
			final OuterJoinLoadable entityPersister = (OuterJoinLoadable) source();
			lhsTableName = getLHSTableName( type, attributeNumber(), entityPersister );
			lhsColumnNames = getLHSColumnNames( type, attributeNumber(), entityPersister, sessionFactory() );
		}
		return new AssociationKey( lhsTableName, lhsColumnNames );
	}
	else {
		return new AssociationKey( joinable.getTableName(), getRHSColumnNames( type, sessionFactory() ) );
	}
}