Java Code Examples for org.hibernate.internal.util.collections.ArrayHelper#join()

The following examples show how to use org.hibernate.internal.util.collections.ArrayHelper#join() . 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: OneToManyPersister.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the SQL UPDATE that updates a particular row's foreign
 * key to null
 */
@Override
protected String generateDeleteRowString() {
	final Update update = new Update( getDialect() )
			.setTableName( qualifiedTableName )
			.addColumns( keyColumnNames, "null" );

	if ( hasIndex && !indexContainsFormula ) {
		for ( int i = 0 ; i < indexColumnNames.length ; i++ ) {
			if ( indexColumnIsSettable[i] ) {
				update.addColumn( indexColumnNames[i], "null" );
			}
		}
	}

	if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) {
		update.setComment( "delete one-to-many row " + getRole() );
	}

	//use a combination of foreign key columns and pk columns, since
	//the ordering of removal and addition is not guaranteed when
	//a child moves from one parent to another
	String[] rowSelectColumnNames = ArrayHelper.join( keyColumnNames, elementColumnNames );
	return update.addPrimaryKeyColumns( rowSelectColumnNames )
			.toStatementString();
}
 
Example 2
Source File: CollectionElementLoader.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public CollectionElementLoader(
		QueryableCollection collectionPersister,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
	super( factory, loadQueryInfluencers );

	this.keyType = collectionPersister.getKeyType();
	this.indexType = collectionPersister.getIndexType();
	this.persister = (OuterJoinLoadable) collectionPersister.getElementPersister();
	this.entityName = persister.getEntityName();

	JoinWalker walker = new EntityJoinWalker(
			persister,
			ArrayHelper.join(
					collectionPersister.getKeyColumnNames(),
					collectionPersister.toColumns( "index" )
			),
			1,
			LockMode.NONE,
			factory,
			loadQueryInfluencers
	);
	initFromWalker( walker );

	postInstantiate();

	if ( LOG.isDebugEnabled() ) {
		LOG.debugf( "Static select for entity %s: %s", entityName, getSQLString() );
	}

}
 
Example 3
Source File: CallbackRegistryImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void registerCallbacks(Class entityClass, Callback[] callbacks) {
	if ( callbacks == null || callbacks.length == 0 ) {
		return;
	}

	final HashMap<Class, Callback[]> map = determineAppropriateCallbackMap( callbacks[0].getCallbackType() );
	Callback[] entityCallbacks = map.get( entityClass );

	if ( entityCallbacks != null ) {
		callbacks = ArrayHelper.join( entityCallbacks, callbacks );
	}
	map.put( entityClass, callbacks );
}
 
Example 4
Source File: AnyType.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int[] sqlTypes(Mapping mapping) throws MappingException {
	return ArrayHelper.join( discriminatorType.sqlTypes( mapping ), identifierType.sqlTypes( mapping ) );
}
 
Example 5
Source File: AnyType.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Size[] dictatedSizes(Mapping mapping) throws MappingException {
	return ArrayHelper.join( discriminatorType.dictatedSizes( mapping ), identifierType.dictatedSizes( mapping ) );
}
 
Example 6
Source File: AnyType.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Size[] defaultSizes(Mapping mapping) throws MappingException {
	return ArrayHelper.join( discriminatorType.defaultSizes( mapping ), identifierType.defaultSizes( mapping ) );
}