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

The following examples show how to use org.hibernate.persister.entity.OuterJoinLoadable#getIdentifierType() . 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: ReactiveCascadeEntityLoader.java    From hibernate-reactive with GNU Lesser General Public License v2.1 6 votes vote down vote up
public ReactiveCascadeEntityLoader(
		OuterJoinLoadable persister,
		CascadingAction action,
		SessionFactoryImplementor factory) throws MappingException {
	super(
			persister,
			persister.getIdentifierType(),
			factory,
			LoadQueryInfluencers.NONE
	);

	initFromWalker( new CascadeEntityJoinWalker( persister, action, factory ) );

	postInstantiate();

	if ( LOG.isDebugEnabled() ) {
		LOG.debugf( "Static select for action %s on entity %s: %s", action, entityName, getSQLString() );
	}
}
 
Example 3
Source File: CascadeEntityLoader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public CascadeEntityLoader(
		OuterJoinLoadable persister,
		CascadingAction action,
		SessionFactoryImplementor factory) throws MappingException {
	super(
			persister,
			persister.getIdentifierType(),
			factory,
			LoadQueryInfluencers.NONE
	);

	JoinWalker walker = new CascadeEntityJoinWalker(
			persister,
			action,
			factory
	);
	initFromWalker( walker );

	postInstantiate();

	if ( LOG.isDebugEnabled() ) {
		LOG.debugf( "Static select for action %s on entity %s: %s", action, entityName, getSQLString() );
	}
}
 
Example 4
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 5
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 6
Source File: CascadeEntityLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public CascadeEntityLoader(
		OuterJoinLoadable persister,
		CascadingAction action,
		SessionFactoryImplementor factory) 
throws MappingException {
	super(
			persister, 
			persister.getIdentifierType(), 
			factory, 
			CollectionHelper.EMPTY_MAP
		);

	JoinWalker walker = new CascadeEntityJoinWalker(
			persister, 
			action,
			factory
		);
	initFromWalker( walker );

	postInstantiate();
	
	log.debug( "Static select for action " + action + " on entity " + entityName + ": " + getSQLString() );

}
 
Example 7
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 8
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 9
Source File: JoinWalker.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Walk the association tree for an entity, adding associations which should
 * be join fetched to the {@link #associations} inst var.  This form is the
 * entry point into the walking for a given entity, starting the recursive
 * calls into {@link #walkEntityTree(org.hibernate.persister.entity.OuterJoinLoadable, String, PropertyPath, int)}.
 *
 * @param persister The persister representing the entity to be walked.
 * @param alias The (root) alias to use for this entity/persister.
 * @param path The property path to the entity being walked
 * @param currentDepth The current join depth
 *
 * @throws org.hibernate.MappingException ???
 */
private void walkEntityTree(
		final OuterJoinLoadable persister,
		final String alias,
		final PropertyPath path,
		final int currentDepth) throws MappingException {
	int n = persister.countSubclassProperties();
	for ( int i = 0; i < n; i++ ) {
		Type type = persister.getSubclassPropertyType( i );
		if ( type.isAssociationType() ) {
			walkEntityAssociationTree(
					(AssociationType) type,
					persister,
					i,
					alias,
					path,
					persister.isSubclassPropertyNullable( i ),
					currentDepth
			);
		}
		else if ( type.isComponentType() ) {
			walkComponentTree(
					(CompositeType) type,
					i,
					0,
					persister,
					alias,
					path.append( persister.getSubclassPropertyName( i ) ),
					currentDepth
			);
		}
	}

	// if the entity has a composite identifier, see if we need to handle
	// its sub-properties separately
	final Type idType = persister.getIdentifierType();
	if ( idType.isComponentType() ) {
		final CompositeType cidType = (CompositeType) idType;
		if ( cidType.isEmbedded() ) {
			// we have an embedded composite identifier.  Most likely we need to process the composite
			// properties separately, although there is an edge case where the identifier is really
			// a simple identifier (single value) wrapped in a JPA @IdClass or even in the case of a
			// a simple identifier (single value) wrapped in a Hibernate composite type.
			//
			// We really do not have a built-in method to determine that.  However, generally the
			// persister would report that there is single, physical identifier property which is
			// explicitly at odds with the notion of "embedded composite".  So we use that for now
			if ( persister.getEntityMetamodel().getIdentifierProperty().isEmbedded() ) {
				walkComponentTree(
						cidType,
						-1,
						0,
						persister,
						alias,
						path,
						currentDepth
				);
			}
		}
	}
}