com.jpattern.orm.query.OrmQuery Maven / Gradle / Ivy
package com.jpattern.orm.query;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.jpattern.orm.classtool.IOrmClassTool;
import com.jpattern.orm.classtool.IOrmClassToolMap;
import com.jpattern.orm.exception.OrmException;
import com.jpattern.orm.exception.OrmNotUniqueResultException;
import com.jpattern.orm.session.IResultSetReader;
import com.jpattern.orm.session.ISessionSqlPerformer;
import com.jpattern.orm.session.ISqlPerformer;
/**
*
* @author Francesco Cina
*
* 20/giu/2011
*/
public class OrmQuery extends ABaseOrmQuery implements IOrmQuery, INameSolverConsumer {
private INameSolver nameSolver = new NullNameSolver();
private final IOrmClassToolMap ormClassToolMap;
private final Class clazz;
private final Class>[] joinClasses;
private boolean distinct;
private final ISessionSqlPerformer session;
private int queryTimeout = 0;
private int maxRows = 0;
private LockMode lockMode = LockMode.NO_LOCK;
public OrmQuery(IOrmClassToolMap ormClassToolMap, ISessionSqlPerformer session, Class clazz, Class>... joinClasses) {
this.ormClassToolMap = ormClassToolMap;
this.session = session;
this.clazz = clazz;
this.joinClasses = joinClasses;
setJoin( new Join(ormClassToolMap) );
}
@Override
public final int getMaxRows() throws OrmException {
return maxRows;
}
@Override
public final IOrmQuery setQueryTimeout(int queryTimeout) {
this.queryTimeout = queryTimeout;
return this;
}
@Override
public final int getQueryTimeout() {
return queryTimeout;
}
@Override
public final IOrmQuery setMaxRows(int maxRows) throws OrmException {
this.maxRows = maxRows;
return this;
}
@Override
public void setNameSolver(INameSolver nameSolver) {
this.nameSolver = nameSolver;
where().setNameSolver(nameSolver);
orderBy().setNameSolver(nameSolver);
join().setNameSolver(nameSolver);
}
@Override
public List findList() {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy