我想改变它,以便TypeEn和TypePl成为一个名为Type的类。我不知道如何改变这种结构:
@Entity
@Table(name="place")
class Place{
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@OneToMany(mappedBy = "place", cascade = CascadeType.ALL)
private List<TypePl> typePl;
@OneToMany(mappedBy = "place", cascade = CascadeType.ALL)
private List<TypeEn> typeEn;
}
TypePl和TypeEn类具有相同的字段:
@Entity
@Table(name = "place_tag_pl")
public class TagPl implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "name")
private String name;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name = "place_id")
private Place place;
}