永发信息网

假设(a="1" and b="2") or(a="2" and c="3") 是一个sql语句的查询条件,用hiber

答案:3  悬赏:50  手机版
解决时间 2021-01-15 15:39
  • 提问者网友:回忆在搜索
  • 2021-01-15 10:19
假设(a="1" and b="2") or(a="2" and c="3") 是一个sql语句的查询条件,用hibernate的Criteria.add替换。
最佳答案
  • 五星知识达人网友:一把行者刀
  • 2021-01-15 11:57
criteria.add(Restrictions.or(
Restrictions.and(
Restrictions.eq("a", new Integer(1)),
Restrictions.eq("b", new Integer(2))
),
Restrictions.and(
Restrictions.eq("a", new Integer(2)),
Restrictions.eq("c", new Integer(3))
)
));
就是这样
全部回答
  • 1楼网友:夜风逐马
  • 2021-01-15 13:04
已经有人回答了哈
  • 2楼网友:空山清雨
  • 2021-01-15 12:33
criteria.add(Restrictions.or(
Restrictions.and(
Restrictions.eq("a", new Integer(1)),
Restrictions.eq("b", new Integer(2))
),
Restrictions.and(
Restrictions.eq("a", new Integer(2)),
Restrictions.eq("c", new Integer(3))
)
));
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯