1对多的关系

//多的一方
@Entity
@Table(name="car_distribute")
public class DistributeCar extends CustomBaseEntity implements LogicDeleteable {
private static final long serialVersionUID = 1L; @ManyToOne (fetch = FetchType.LAZY)
@JoinColumn(name="approval_for_car_id")
private ApprovalForCar approvalForCar;
@Entity
@Table(name = "CAR_APPROVAL")
public class ApprovalForCar extends CustomBaseEntity implements LogicDeleteable {
private static final long serialVersionUID = 1L; //派车单
@JsonIgnore
@OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY,mappedBy = "approvalForCar")
private List<DistributeCar> distributeCars =new ArrayList<>(0);

  

  

05-08 08:06