💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 配置 User类: ~~~ //配置多对多的关系 //targetEntity:对方的字节码文件.mappedBy:自己在对方的属性名 @ManyToMany(targetEntity = Role.class) @JoinTable( //中间表名 name = "user_role", joinColumns = { //name:自己在中间表外键字段名.referencedColumnName:指向自己的主键字段名. @JoinColumn(name = "user_id", referencedColumnName = "id") }, inverseJoinColumns = { //name:对方在中间表的外键字段名.referencedColumnName:指向对方主键名. @JoinColumn(name = "role_id", referencedColumnName = "id") }) private Set<Role> roles = new HashSet<>(); ~~~ Role类: ~~~ //配置多对多的关系 //targetEntity:对方的字节码文件对象.mappedBy:自己在对方的属性名. @ManyToMany(targetEntity = User.class, mappedBy = "roles") private Set<User> users = new HashSet<>(); ~~~