早教吧 育儿知识 作业答案 考试题库 百科 知识分享

Hibernate中find方法HQL语句and和or的混合使用我想写一个HQL语句查询使用,就是有一个ID条件是必须的,其他的一些条件是或的(就是几个条件中符合一个就可以)设想是fromGoodswherename=orval

题目详情
Hibernate 中find方法HQL语句 and 和 or 的混合使用
我想写一个HQL语句查询使用,就是有一个ID条件是必须的,其他的一些条件是或的(就是几个条件中符合一个就可以)
设想是 from Goods where name = or value or mark and ID
但是我现在这样做,and没有效果,不属于这个Id的也可以查到这个Id下的消息
请问该如何更改?
▼优质解答
答案和解析
from Goods where id = and (name = or name is null) and (value = or value is null) and (mark = or mark is null)
这样试试...or不能连接那么多的...