All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.hql.spi.id.inline.InlineIdsIdsInClauseDeleteHandlerImpl Maven / Gradle / Ivy

The newest version!
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.hql.spi.id.inline;

import java.util.List;

import org.hibernate.dialect.Dialect;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.hql.internal.ast.HqlSqlWalker;
import org.hibernate.hql.spi.id.MultiTableBulkIdStrategy;

/**
 * Inline bulk-id delete handler that uses an IN clause.
 *
 * @author Vlad Mihalcea
 */
public class InlineIdsIdsInClauseDeleteHandlerImpl
		extends AbstractInlineIdsDeleteHandlerImpl
		implements MultiTableBulkIdStrategy.DeleteHandler {

	public InlineIdsIdsInClauseDeleteHandlerImpl(
			SessionFactoryImplementor factory,
			HqlSqlWalker walker) {
		super( factory, walker );
		Dialect dialect = factory.getServiceRegistry().getService( JdbcServices.class ).getDialect();
		if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) {
			throw new UnsupportedOperationException(
					"The " + getClass().getSimpleName() +
							" can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!"
			);
		}
	}

	@Override
	protected IdsClauseBuilder newIdsClauseBuilder(List ids) {
		return new InlineIdsInClauseBuilder(
				dialect(),
				getTargetedQueryable().getIdentifierType(),
				factory().getTypeResolver(),
				getTargetedQueryable().getIdentifierColumnNames(),
				ids
		);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy