2

コレクション テーブルにマップされたフィールドから特定のユーザー ID を削除したいと考えています。これは、単一の QueryDSL JPA update ステートメントでどのように可能ですか?

必要なものは次のようなものです。

new JPAUpdateClause(getEntityManager(), sharing).where(sharing.key.eq(sharingKey))
                        .set(sharing.userIds, ***sharing.userIds - userId***).execute();

マップされたクラス:

public class Sharing {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;
    @Column(name = "naturalid", unique = true)
    private String key;
    private int creatorUserId;
    @ElementCollection
    @CollectionTable(name = "pla_sharing2users", joinColumns = @JoinColumn(name = "sid"))
    @Column(name = "uid")
    private Set<Integer> userIds;
...
}
4

0 に答える 0