三个类:
Order类:private OrderAmount orderAmount;//订单金额对象属性
OrderAmount类:private Double totalAmount;金额属性
private Payment payment;//支付对象属性
Payment类:private int payId;//id属性
Criteria 的条件查询:
Criteria criteria=session.createCriteria(Order.class);criteria.add(Restrictions.between("orderAmount.totalAmount", order.getOrderAmount().getTotalAmount(), orderModel.getOrderAmount().getTemptotal()));
criteria.add(Restrictions.eq("orderAmount.payment.payId", order.getOrderAmount().getTotalAmount(), orderModel.getOrderAmount().getTemptotal()));
请问各位高手,这样写:Restrictions.between("orderAmount.totalAmount")和Restrictions.eq("orderAmount.payment.payId")是不是错的?要是错的话,那应该怎么写呢?
Order类:private OrderAmount orderAmount;//订单金额对象属性
OrderAmount类:private Double totalAmount;金额属性
private Payment payment;//支付对象属性
Payment类:private int payId;//id属性
Criteria 的条件查询:
Criteria criteria=session.createCriteria(Order.class);criteria.add(Restrictions.between("orderAmount.totalAmount", order.getOrderAmount().getTotalAmount(), orderModel.getOrderAmount().getTemptotal()));
criteria.add(Restrictions.eq("orderAmount.payment.payId", order.getOrderAmount().getTotalAmount(), orderModel.getOrderAmount().getTemptotal()));
请问各位高手,这样写:Restrictions.between("orderAmount.totalAmount")和Restrictions.eq("orderAmount.payment.payId")是不是错的?要是错的话,那应该怎么写呢?
解决方案 »
- 请问hibernate3.0是不是不支持select嵌套子查询?!
- struts框架中单选按钮的应用
- 哪位能提供一个eclipse开发Web Service的实例及源码?分不够还可以加!
- 如何在jtable 中添加右键弹出菜单
- 求助Hibernate简单问题
- 毕业论文求助--石大在线财务管理系统版
- [200分]在xml的SAX解析当中接口ContentHandler的方法startElement的参数String localName,String qName有什么联系和区别?
- JBOSS4.01 配置jms的问题
- EJB问题高分请教!!急!CMR的外键可不可以再加入到CMP中?我用的是Websphere!
- 怎么让tomcat后台运行
- 熟悉webservice的进来,配置多个服务接口。
- 求助:希望给个网站的源码
/** 看看这一行会明白吧!这个就是用属性类的属性来过滤,需求有个属性是指派人,指派人有个属性是部门,现在查询的过滤条件是部门,用部门的ID来过滤 */
criteria.createCriteria("assignor").createCriteria("xtDept").add(Restrictions.eq("deptId", deptId));
}
if (status != null) {
criteria.add(Restrictions.in("status", status));
}
if (fromDate!=null && toDate!=null) {
criteria.add(Restrictions.between("noteDate", fromDate, toDate));
}