StringBuilder sb = new StringBuilder();
sb.append("SELECT * FROM ");
sb.append(HibernateConfigurationHelper.getTableName(entityClass));
if (null != property&&null != proValue) {
sb.append("property='");
sb.append(proValue);
sb.append("'");
}
if(null!=ascProperty){
sb.append(" ORDER BY ");
//sb.append(alias);
//sb.append(".");
sb.append(ascProperty);
if(isAsc)
sb.append(" ASC ");
else
sb.append(" DESC ");
}
if (0!=limit) {
sb.append(" LIMIT ");
sb.append(start);
sb.append(",");
sb.append(limit);
}
Query q = getSession().createSQLQuery(sb.toString()).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
sb.append("SELECT * FROM ");
sb.append(HibernateConfigurationHelper.getTableName(entityClass));
if (null != property&&null != proValue) {
sb.append("property='");
sb.append(proValue);
sb.append("'");
}
if(null!=ascProperty){
sb.append(" ORDER BY ");
//sb.append(alias);
//sb.append(".");
sb.append(ascProperty);
if(isAsc)
sb.append(" ASC ");
else
sb.append(" DESC ");
}
if (0!=limit) {
sb.append(" LIMIT ");
sb.append(start);
sb.append(",");
sb.append(limit);
}
Query q = getSession().createSQLQuery(sb.toString()).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);