用hibernate的Criteria查询排序出错
Criteria criteria = getSession().createCriteria(Test.class);
criteria.add(Expression.eq("path", path));
criteria.addOrder(Order.asc("date"));
List list = criteria.list();
一般时候都可以,有时会出错:
org.hibernate.exception.GenericJDBCException: could not inspect JDBC autocommit mode
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at org.hibernate.exception.
JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:338)
at org.hibernate.impl.SessionImpl.afterOperation(SessionImpl.java:398)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1330)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:300)
------解决方案--------------------date字段有没有空数据?
------解决方案--------------------以前也遇到过这样问题,大概是没采用事务的原因