Java Code Examples for org.hibernate.persister.entity.OuterJoinLoadable#getIdentifierColumnNames()

The following examples show how to use org.hibernate.persister.entity.OuterJoinLoadable#getIdentifierColumnNames() . 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: ReactiveEntityLoader.java    From hibernate-reactive with GNU Lesser General Public License v2.1 6 votes vote down vote up
public ReactiveEntityLoader(
		OuterJoinLoadable persister,
		int batchSize,
		LockMode lockMode,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
	this(
			persister,
			persister.getIdentifierType(),
			factory,
			loadQueryInfluencers,
			new EntityJoinWalker(
					persister,
					persister.getIdentifierColumnNames(),
					batchSize,
					lockMode,
					factory,
					loadQueryInfluencers
			) );

	if ( LOG.isDebugEnabled() ) {
		LOG.debugf( "Static select for entity %s [%s]: %s", entityName, lockMode, getSQLString() );
	}
}
 
Example 2
Source File: EntityLoader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public EntityLoader(
		OuterJoinLoadable persister,
		int batchSize,
		LockMode lockMode,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
	this(
			persister,
			persister.getIdentifierColumnNames(),
			persister.getIdentifierType(),
			batchSize,
			lockMode,
			factory,
			loadQueryInfluencers
		);
}
 
Example 3
Source File: EntityLoader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public EntityLoader(
		OuterJoinLoadable persister,
		int batchSize,
		LockOptions lockOptions,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
	this(
			persister,
			persister.getIdentifierColumnNames(),
			persister.getIdentifierType(),
			batchSize,
			lockOptions,
			factory,
			loadQueryInfluencers
		);
}
 
Example 4
Source File: EntityLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public EntityLoader(
		OuterJoinLoadable persister, 
		int batchSize, 
		LockMode lockMode,
		SessionFactoryImplementor factory, 
		Map enabledFilters) 
throws MappingException {
	this( 
			persister, 
			persister.getIdentifierColumnNames(), 
			persister.getIdentifierType(), 
			batchSize,
			lockMode,
			factory, 
			enabledFilters 
		);
}
 
Example 5
Source File: ReactiveEntityLoader.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ReactiveEntityLoader(
		OuterJoinLoadable persister,
		int batchSize,
		LockOptions lockOptions,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
	this(
			persister,
			persister.getIdentifierType(),
			factory,
			loadQueryInfluencers,
			new EntityJoinWalker(
					persister,
					persister.getIdentifierColumnNames(),
					batchSize,
					lockOptions,
					factory,
					loadQueryInfluencers
			) );

	if ( LOG.isDebugEnabled() ) {
		LOG.debugf( "Static select for entity %s [%s:%s]: %s",
				entityName,
				lockOptions.getLockMode(),
				lockOptions.getTimeOut(),
				getSQLString() );
	}
}
 
Example 6
Source File: ReactiveDynamicBatchingEntityLoader.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ReactiveDynamicBatchingEntityLoader(
		OuterJoinLoadable persister,
		int maxBatchSize,
		LockMode lockMode,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) {
	super( persister, -1, lockMode, factory, loadQueryInfluencers );

	EntityJoinWalker walker = new EntityJoinWalker(
			persister,
			persister.getIdentifierColumnNames(),
			-1,
			lockMode,
			factory,
			loadQueryInfluencers) {
		@Override
		protected StringBuilder whereString(String alias, String[] columnNames, int batchSize) {
			return buildBatchFetchRestrictionFragment(
					alias,
					columnNames,
					getDialect()
			);
		}
	};

	initFromWalker( walker );
	this.sqlTemplate = walker.getSQLString();
	this.alias = walker.getAlias();
	postInstantiate();

	if ( LOG.isDebugEnabled() ) {
		LOG.debugf(
				"SQL-template for dynamic entity [%s] batch-fetching [%s] : %s",
				entityName,
				lockMode,
				sqlTemplate
		);
	}
}
 
Example 7
Source File: DynamicBatchingEntityLoaderBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public DynamicEntityLoader(
		OuterJoinLoadable persister,
		int maxBatchSize,
		LockMode lockMode,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) {
	super( persister, -1, lockMode, factory, loadQueryInfluencers );

	EntityJoinWalker walker = new EntityJoinWalker(
			persister,
			persister.getIdentifierColumnNames(),
			-1,
			lockMode,
			factory,
			loadQueryInfluencers) {
		@Override
		protected StringBuilder whereString(String alias, String[] columnNames, int batchSize) {
			return StringHelper.buildBatchFetchRestrictionFragment(
					alias,
					columnNames,
					getFactory().getDialect()
			);
		}
	};

	initFromWalker( walker );
	this.sqlTemplate = walker.getSQLString();
	this.alias = walker.getAlias();
	postInstantiate();

	if ( LOG.isDebugEnabled() ) {
		LOG.debugf(
				"SQL-template for dynamic entity [%s] batch-fetching [%s] : %s",
				entityName,
				lockMode,
				sqlTemplate
		);
	}
}
 
Example 8
Source File: JoinHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static String[] toColumns(OuterJoinLoadable persister, String columnQualifier, int propertyIndex) {
	if ( propertyIndex >= 0 ) {
		return persister.toColumns( columnQualifier, propertyIndex );
	}
	else {
		final String[] cols = persister.getIdentifierColumnNames();
		final String[] result = new String[cols.length];

		for ( int j = 0; j < cols.length; j++ ) {
			result[j] = StringHelper.qualify( columnQualifier, cols[j] );
		}

		return result;
	}
}
 
Example 9
Source File: JoinHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the columns of the owning entity which are to be used in the join
 *
 * @param type The type representing the join
 * @param property The property index for the association type
 * @param begin ?
 * @param lhsPersister The persister for the left-hand-side of the join
 * @param mapping The mapping object (typically the SessionFactory)
 *
 * @return The columns for the left-hand-side of the join
 */
public static String[] getLHSColumnNames(
		AssociationType type,
		int property,
		int begin,
		OuterJoinLoadable lhsPersister,
		Mapping mapping) {
	if ( type.useLHSPrimaryKey() ) {
		//return lhsPersister.getSubclassPropertyColumnNames(property);
		return lhsPersister.getIdentifierColumnNames();
	}
	else {
		final String propertyName = type.getLHSPropertyName();
		if ( propertyName == null ) {
			//slice, to get the columns for this component
			//property
			return ArrayHelper.slice(
					property < 0
							? lhsPersister.getIdentifierColumnNames()
							: lhsPersister.getSubclassPropertyColumnNames( property ),
					begin,
					type.getColumnSpan( mapping )
			);
		}
		else {
			//property-refs for associations defined on a
			//component are not supported, so no need to slice
			return lhsPersister.getPropertyColumnNames( propertyName );
		}
	}
}
 
Example 10
Source File: JoinHelper.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Get the columns of the owning entity which are to 
 * be used in the join
 */
public static String[] getLHSColumnNames(
		AssociationType type, 
		int property, 
		int begin, 
		OuterJoinLoadable lhsPersister,
		Mapping mapping
) {
	if ( type.useLHSPrimaryKey() ) {
		//return lhsPersister.getSubclassPropertyColumnNames(property);
		return lhsPersister.getIdentifierColumnNames();
	}
	else {
		String propertyName = type.getLHSPropertyName();
		if (propertyName==null) {
			//slice, to get the columns for this component
			//property
			return ArrayHelper.slice( 
					lhsPersister.getSubclassPropertyColumnNames(property),
					begin, 
					type.getColumnSpan(mapping) 
				);
		}
		else {
			//property-refs for associations defined on a
			//component are not supported, so no need to slice
			return lhsPersister.getPropertyColumnNames(propertyName);
		}
	}
}