Creating new entity plus association not working

后端 未结 1 852
时光取名叫无心
时光取名叫无心 2020-12-21 07:19

I am having two entities AppUser and UserGroup. They have a @ManyToMany relationship.

I am currently trying to create

相关标签:
1条回答
  • 2020-12-21 08:09

    try

    @Column(name = "app_user_id")
    @ManyToMany(fetch = FetchType.LAZY, mappedBy = "groups",cascade = CascadeType.ALL)
    private Set<AppUser> users;
    

    finally pass list of users

    {
      "name": "Group 1", 
      "users": ["http://localhost:8080/users/1"]
    }
    

    for Cannot deserialize instance of java.util.Set error it expect a list of users not instans of single user

    0 讨论(0)
提交回复
热议问题