@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", unique = true, nullable = false)
private Integer id;
@JsonIgnore
@ManyToOne
@JoinColumn(name="pid")
private ConfigBean parent;
@OrderBy("sort asc,id asc")
@OneToMany(fetch = FetchType.LAZY,cascade = CascadeType.ALL,mappedBy = "parent")
private List<ConfigBean> childrens = new ArrayList<ConfigBean>(0);
单表的一对多多对一的自关联配置
最新推荐文章于 2023-01-11 16:59:49 发布
本文解析了一个配置Bean实体类的Java代码片段,该实体类包括ID、父级配置和子配置列表等属性,并采用注解如@ManyToOne、@OneToMany进行关联映射。
1万+

被折叠的 条评论
为什么被折叠?



