Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个名为 Product 的课程。每个产品都有一个序列号。我想返回列表中具有序列号的所有产品。就像是
Restrictions.eq("serial_number", mySerialNumberList);
可以简洁地完成,还是我必须构建一个包含大量“或”属性的巨大查询?
这就是IN运营商的用途:
IN
Restrictions.in("serialNumber", mySerialNumberList);
但要小心:传递一个空列表将导致 SQL 语法异常。