org.hibernate.query.criteria.internal.CriteriaDeleteImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* 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();
}
}