org.ibatis.persist.impl.CriteriaDeleteImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbatis Show documentation
Show all versions of jbatis Show documentation
The jBATIS persistence framework will help you to significantly reduce the amount of Java code that you normally need to access a relational database. iBATIS simply maps JavaBeans to SQL statements using a very simple XML descriptor.
The newest version!
package org.ibatis.persist.impl;
import org.ibatis.persist.Parameter;
import org.ibatis.persist.criteria.CriteriaDelete;
import org.ibatis.persist.criteria.Expression;
import org.ibatis.persist.criteria.Predicate;
@SuppressWarnings("unchecked")
public class CriteriaDeleteImpl extends CriteriaManipulationimplements CriteriaDelete {
protected CriteriaDeleteImpl(CriteriaBuilderImpl criteriaBuilder, Class targetEntity) {
super(criteriaBuilder, targetEntity);
}
@Override
public CriteriaDelete where(Expression restriction) {
setRestriction(restriction);
return this;
}
@Override
public CriteriaDelete where(Predicate... restrictions) {
setRestriction(restrictions);
return this;
}
@Override
protected void renderQuery(RenderingContext rc) {
rc.append("delete from ");
renderRoot(rc);
renderRestrictions(rc);
}
@Override
public CriteriaDelete setParameter(Parameter param, R value) {
ParameterInfo pi = (ParameterInfo) param;
pi.setParameterValue(value);
return this;
}
@Override
public CriteriaDelete setParameter(String name, R value) {
return setParameter((Parameter) getParameter(name), value);
}
@Override
public CriteriaDelete setParameter(int position, R value) {
for (Parameter> p : getParameters()) {
if (p.getPosition() != null && p.getPosition() == position) {
setParameter((Parameter) p, value);
return this;
}
}
throw new IllegalArgumentException("" + position);
}
@Override
public Class> getResultType() {
return Integer.class;
}
}