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

org.hibernate.query.criteria.internal.CriteriaDeleteImpl Maven / Gradle / Ivy

There is a newer version: 6.5.0.CR2
Show 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.query.criteria.internal;

import javax.persistence.criteria.CriteriaDelete;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Predicate;

import org.hibernate.query.criteria.internal.compile.RenderingContext;

/**
 * Hibernate implementation of the JPA 2.1 {@link CriteriaDelete} contract.
 *
 * @author Steve Ebersole
 */
public class CriteriaDeleteImpl extends AbstractManipulationCriteriaQuery implements CriteriaDelete {
	protected CriteriaDeleteImpl(CriteriaBuilderImpl criteriaBuilder) {
		super( criteriaBuilder );
	}

	@Override
	public CriteriaDelete where(Expression restriction) {
		setRestriction( restriction );
		return this;
	}

	@Override
	public CriteriaDelete where(Predicate... restrictions) {
		setRestriction( restrictions );
		return this;
	}

	@Override
	protected String renderQuery(RenderingContext renderingContext) {
		final StringBuilder jpaql = new StringBuilder( "delete " );
		renderRoot( jpaql, renderingContext );
		renderRestrictions( jpaql, renderingContext );

		return jpaql.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy