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

The following examples show how to use org.hibernate.util.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 cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Generate the SQL UPDATE that updates a particular row's foreign
 * key to null
 */
protected String generateDeleteRowString() {
	
	Update update = new Update( getDialect() )
			.setTableName( qualifiedTableName )
			.addColumns( keyColumnNames, "null" );
	
	if ( hasIndex && !indexContainsFormula ) update.addColumns( indexColumnNames, "null" );
	
	if ( getFactory().getSettings().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.setPrimaryKeyColumnNames( rowSelectColumnNames )
			.toStatementString();
}
 
Example 2
Source File: CollectionElementLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public CollectionElementLoader(
		QueryableCollection collectionPersister,
		SessionFactoryImplementor factory, 
		Map enabledFilters) 
throws MappingException {
	super(factory, enabledFilters);

	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.getIndexColumnNames()
				),
			1, 
			LockMode.NONE, 
			factory, 
			enabledFilters
		);
	initFromWalker( walker );

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

}
 
Example 3
Source File: AnyType.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public int[] sqlTypes(Mapping mapping) throws MappingException {
	return ArrayHelper.join(
			metaType.sqlTypes(mapping),
			identifierType.sqlTypes(mapping)
		);
}