0
 Criteria crit=hbSession.createCriteria(S1.class)
.add(Restrictions.between("s1Docdt",startDate, endDate))
.add(Restrictions.eq("s1BranchCode",branchCode))    
.add(Restrictions.eq("s1AccountingYear",year));
 crit.addOrder(Order.asc("s1Docdt","s1Dcno","s1Tc");

我创建了一个会话并尝试添加限制并收到错误,因此任何人都可以帮助我。

4

1 回答 1

0

根据 Hibernate Javadoc Order.asc(String)方法,您的代码对我来说似乎是错误的。试试这个:

Criteria crit = hbSession.createCriteria(S1.class)
    .add(Restrictions.between("s1Docdt",startDate, endDate))
    .add(Restrictions.eq("s1BranchCode",branchCode))    
    .add(Restrictions.eq("s1AccountingYear",year));
crit.addOrder(Order.asc("s1Docdt"));
crit.addOrder(Order.asc("s1Dcno"));
crit.addOrder(Order.asc("s1Tc"));

希望这可以帮助。

于 2012-08-10T10:47:50.457 回答