import org.hibernate.criterion.Order;\r
import org.hibernate.criterion.Projections;\r
import org.hibernate.criterion.Restrictions;\r
+import org.hibernate.envers.query.AuditQuery;\r
import org.springframework.dao.DataAccessException;\r
import org.springframework.stereotype.Repository;\r
\r
return list(limit, start, null); \r
}\r
\r
- public List<T> list(Integer limit, Integer start, List<OrderHint> orderHints) {\r
+ public <TYPE extends T> List<TYPE> list(Integer limit, Integer start, List<OrderHint> orderHints) {\r
\r
Criteria crit = getSession().createCriteria(type); \r
if(limit != null) {\r
public Class<T> getType() {\r
return type;\r
}\r
+ \r
+ protected void setPagingParameter(Query query, Integer pageSize, Integer pageNumber){\r
+ if(pageSize != null) {\r
+ query.setMaxResults(pageSize);\r
+ if(pageNumber != null) {\r
+ query.setFirstResult(pageNumber * pageSize);\r
+ } else {\r
+ query.setFirstResult(0);\r
+ }\r
+ }\r
+ }\r
+ \r
+ protected void setPagingParameter(AuditQuery query, Integer pageSize, Integer pageNumber){\r
+ if(pageSize != null) {\r
+ query.setMaxResults(pageSize);\r
+ if(pageNumber != null) {\r
+ query.setFirstResult(pageNumber * pageSize);\r
+ } else {\r
+ query.setFirstResult(0);\r
+ }\r
+ }\r
+ }\r
}\r