org.hibernate.loader.entity.EntityLoader Java Examples

The following examples show how to use org.hibernate.loader.entity.EntityLoader. 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: AbstractEntityPersister.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private EntityLoader getAppropriateUniqueKeyLoader(String propertyName, SharedSessionContractImplementor session) {
	final boolean useStaticLoader = !session.getLoadQueryInfluencers().hasEnabledFilters()
			&& !session.getLoadQueryInfluencers().hasEnabledFetchProfiles()
			&& propertyName.indexOf( '.' ) < 0; //ugly little workaround for fact that createUniqueKeyLoaders() does not handle component properties

	if ( useStaticLoader ) {
		return (EntityLoader) uniqueKeyLoaders.get( propertyName );
	}
	else {
		return createUniqueKeyLoader(
				propertyMapping.toType( propertyName ),
				propertyMapping.toColumns( propertyName ),
				session.getLoadQueryInfluencers()
		);
	}
}
 
Example #2
Source File: AbstractEntityPersister.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private EntityLoader createUniqueKeyLoader(
		Type uniqueKeyType,
		String[] columns,
		LoadQueryInfluencers loadQueryInfluencers) {
	if ( uniqueKeyType.isEntityType() ) {
		String className = ( (EntityType) uniqueKeyType ).getAssociatedEntityName();
		uniqueKeyType = getFactory().getMetamodel().entityPersister( className ).getIdentifierType();
	}
	return new EntityLoader(
			this,
			columns,
			uniqueKeyType,
			1,
			LockMode.NONE,
			getFactory(),
			loadQueryInfluencers
	);
}
 
Example #3
Source File: AbstractEntityPersister.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private EntityLoader getAppropriateUniqueKeyLoader(String propertyName, Map enabledFilters) {

		final boolean useStaticLoader = ( enabledFilters == null || enabledFilters.isEmpty() )
				&& propertyName.indexOf('.')<0; //ugly little workaround for fact that createUniqueKeyLoaders() does not handle component properties

		if ( useStaticLoader ) {
			return (EntityLoader) uniqueKeyLoaders.get( propertyName );
		}
		else {
			return createUniqueKeyLoader(
					propertyMapping.toType(propertyName),
					propertyMapping.toColumns(propertyName),
					enabledFilters
				);
		}
	}
 
Example #4
Source File: AbstractEntityPersister.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private EntityLoader createUniqueKeyLoader(Type uniqueKeyType, String[] columns, Map enabledFilters) {
	if ( uniqueKeyType.isEntityType() ) {
		String className = ( ( EntityType ) uniqueKeyType ).getAssociatedEntityName();
		uniqueKeyType = getFactory().getEntityPersister( className ).getIdentifierType();
	}

	return new EntityLoader( this, columns, uniqueKeyType, 1, LockMode.NONE, getFactory(), enabledFilters );
}
 
Example #5
Source File: BatchingEntityLoader.java    From webdsl with Apache License 2.0 5 votes vote down vote up
public static BatchingEntityLoader createBatchingEntityLoader(
			final OuterJoinLoadable persister,
			final SessionFactoryImplementor factory) throws MappingException {
			int[] batchSizesToCreate = ArrayHelper.getBatchSizes(DEFAULT_MAX_BATCH_SIZE);
      //System.out.print("created loader");
			Loader[] loadersToCreate = new Loader[ batchSizesToCreate.length ];
			for ( int i=0; i<batchSizesToCreate.length; i++ ) {
				loadersToCreate[i] = new EntityLoader(persister, batchSizesToCreate[i], LockMode.NONE, factory, LoadQueryInfluencers.NONE);
//        System.out.print(", " + batchSizesToCreate[i]);
			}
//      org.webdsl.logging.Logger.info();
			return new BatchingEntityLoader(persister, batchSizesToCreate, loadersToCreate);
	}