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.
我的实体User有一个基本集合:
User
@ElementCollection private Set<String> completedQuests = Sets.newHashSet();
如何从该集中为所有/多个用户删除一些值?这个伪查询的正确 JPQL 是什么?
DELETE FROM User.completeQuests WHERE value IN (:collectionOfValues)
(也欢迎仅使用 Hibernate 的替代方案,虽然不是首选。)
如果一切都失败了,原生 SQL。
em .createNativeQuery( "DELETE FROM user_completedquests " + "WHERE completedquests IN (:daily)" ) .setParameter("daily", dailyQuests) .executeUpdate();
(还没有测试过)