语法正确吗?该 map 包含多个值并被转换为数组。
criteria.add(Restrictions.like("os", "%"+( ((ArrayList<String>)map.get("os") ).toArray())+"%" ) )
这是正确的语法吗?
最佳答案
您需要迭代映射中的条目,并为每个条目添加一个
Restrictions.like("os", "%"+entry+"%" )
加入这些
Restrictions.or(...)
使用
将完整的集合添加到条件中 criteria.add
关于java - 对于包含多个值并转换为数组的映射,正确的语法是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11013259/