return query(clazz, (page - 1) * pageSize, pageSize, sql, ids);
}
private SQLQuery preparedSqlQuery(String sql, Object... ids)
{
SQLQuery query = session.createSQLQuery(sql);
if (!Util.isEmpty(ids))
{
int i = 0;
for (Object obj : ids)
{
// TODO ovo treba jos doraditi , za razne tipove
if (obj instanceof Integer)
{
query.setInteger(i, (Integer)obj);
}
else if (obj instanceof String)
{
query.setString(i, (String)obj);
}
else if (obj instanceof Date)
{
query.setDate(i, (Date)obj);
}
i++;
}