嗨我正在网上开发所以我有一个ajax函数调用一个控制器函数调用DAO函数(在DB上进行更改).我在控制器功能中得到了上面的例外..
控制器功能:
@RequestMapping(value="/changeIsPublic", method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody boolean changeIsPublic(HttpServletRequest request, Locale locale, Model model, long transactionId, boolean isPublic) {
boolean result = false;
try {
boxDao.changeIsPublicStatus(transactionId, isPublic);
result = true;
} catch (Exception e) {
logger.debug("Failed to publish transaction. transaction ID: " + transactionId + e.getMessage());
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
DAO功能:
public Box changeIsPublicStatus(long id, boolean isPublic) {
Criteria criteria = getCurrentSession().createCriteria(Box.class);
criteria.add(Restrictions.eq("id", id));
Box transaction = (Box) criteria.uniqueResult();
transaction.setIsPublic(isPublic);
return transaction;
}
Run Code Online (Sandbox Code Playgroud)
例外:
SEVERE: Servlet.service() for servlet …Run Code Online (Sandbox Code Playgroud)