所以这是代码:
public static List<Zahtev> getZahtevSearchContainerList(RenderRequest request, Long groupId, SearchContainer<Zahtev> searchContainer, Criterion permanentCriterion) throws SystemException {
int start = (searchContainer!=null) ? searchContainer.getStart() : QueryUtil.ALL_POS;
int end = (searchContainer!=null) ? searchContainer.getEnd() : QueryUtil.ALL_POS;
Criterion criterion = null;
if(statusId == 0){
try {
Status statusP = StatusLocalServiceUtil.getStatussByOpis("Predato");
Status statusO = StatusLocalServiceUtil.getStatussByOpis("Odustanak od nabavke");
Criterion criterion1 = RestrictionsFactoryUtil.eq("status", statusP.getId());
criterion1 = RestrictionsFactoryUtil.and(criterion1, RestrictionsFactoryUtil.eq("vrednost", 0.0));
criterion1 = RestrictionsFactoryUtil.or(criterion1, RestrictionsFactoryUtil.ne("status", statusP.getId()));
Criterion criterion2 = RestrictionsFactoryUtil.eq("status", statusO.getId());
Calendar fromDate = Calendar.getInstance();
fromDate.setTime(new Date());
fromDate.set(Calendar.HOUR_OF_DAY, 0);
fromDate.set(Calendar.MINUTE, 0);
fromDate.set(Calendar.SECOND, 0);
fromDate.set(Calendar.MILLISECOND, 0);
criterion2 = RestrictionsFactoryUtil.and(criterion2, RestrictionsFactoryUtil.gt("datumRokaZaPredaju", fromDate.getTime()));
criterion2 = RestrictionsFactoryUtil.or(criterion2, RestrictionsFactoryUtil.ne("status", statusO.getId()));
criterion = RestrictionsFactoryUtil.and(criterion1, criterion2);
} catch (NoSuchStatusException e1) {
e1.printStackTrace();
}
}else{
criterion = RestrictionsFactoryUtil.eq("status", statusId);
}
query = null;
try {
// String sortByType = ParamUtil.getString(request, "orderByType");
query = createQuery(request, groupId, permanentCriterion);
String newSortByCol = getSortColumnName("zahtev");
if ( newSortByCol!=null ) {
//if ( newSortByCol.equalsIg
noreCase(sortByCol) ) ascending = !ascending;
query.addOrder( ascending ? OrderFactoryUtil.asc(newSortByCol) : OrderFactoryUtil.desc(newSortByCol));
} else {
for ( String s : mainOrderColumns ) {
query.addOrder(OrderFactoryUtil.asc(s));
}
}
query.setLimit(start, end);
if(criterion!= null)
query.add(criterion);
return (List<Zahtev>) ZahtevLocalServiceUtil.dynamicQuery(query);
} catch (Exception e) {
}
query = null;
if ( zahtevGroupSensitive ) return (List<Zahtev>) ZahtevLocalServiceUtil.getZahtevsByGroupId(groupId, searchContainer.getStart(), searchContainer.getEnd());
return (List<Zahtev>) ZahtevLocalServiceUtil.getAll(start, end);
}
当我启动服务器时,它可以正常工作一段时间,但在某些时候会出现错误: 错误[http-bio-80-exec-10] [BasePersistenceImpl:202]捕获意外异常org.hibernate.QueryException 然后它停止了。当我再次重新启动服务器时,它再次工作正常。 有任何想法吗 ? 感谢