com.jpattern.orm.query.sql.PlainSqlFindQuery Maven / Gradle / Ivy
package com.jpattern.orm.query.sql;
import java.math.BigDecimal;
import java.util.List;
import com.jpattern.orm.exception.OrmException;
import com.jpattern.orm.exception.OrmNotUniqueResultException;
import com.jpattern.orm.query.AQuery;
import com.jpattern.orm.query.SqlFindQuery;
import com.jpattern.orm.session.ResultSetReader;
import com.jpattern.orm.session.SessionSqlPerformer;
import com.jpattern.orm.session.SqlPerformer;
/**
*
* @author Francesco Cina
*
* 09/lug/2011
*/
public class PlainSqlFindQuery extends AQuery implements SqlFindQuery {
/**
*
*/
private final SessionSqlPerformer session;
private final String sql;
private final Object[] args;
private int queryTimeout = 0;
private int maxRows = 0;
public PlainSqlFindQuery(SessionSqlPerformer session, String sql, Object[] args) {
this.session = session;
this.sql = sql;
this.args = args;
}
@Override
public final int getMaxRows() throws OrmException {
return maxRows;
}
@Override
public final SqlFindQuery setQueryTimeout(int queryTimeout) {
this.queryTimeout = queryTimeout;
return this;
}
@Override
public final int getQueryTimeout() {
return queryTimeout;
}
@Override
public final SqlFindQuery setMaxRows(int maxRows) throws OrmException {
this.maxRows = maxRows;
return this;
}
@Override
public T find(ResultSetReader rse) throws OrmException {
SqlPerformer sqlExec = session.sqlPerformer();
sqlExec.setMaxRows(getMaxRows());
sqlExec.setQueryTimeout(getQueryTimeout());
return sqlExec.query(renderSql(), rse , args);
}
@Override
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy