@Entity
public class User implements Serizlizable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id
private String userName
private String passWord
@ManyToMany(cascade = CascadeType.ALL)
private List<Role>roles
......
......
}
@Entity
public class Role implements Serizlizable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id
private String role
@ManyToMany(mappedBy = "roles")
private User user
......
......
}
配置伍闷后,会在数据库中生存你想要的3个滚亩表。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)