我低于错误


  org.hibernate.AnnotationException:mappedBy引用未知目标实体属性:my.backend.dataObject.PayTransactionStatement.payMaster中的my.backend.dataObject.PayMaster.PayTransactionStatement。


我检查了所有实体,但仍然无法解决问题

@Data
@Entity
@Table(name = "pay_master")
@DynamicUpdate //Dynamic update - you need to set the update time field of the database to be automatically updated. In this way, query the time, save the other fields and save the update time.
public class PayMaster {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name="paymaster_id")
    private Long paymasterid;


    @ManyToOne(fetch= FetchType.LAZY)
    @JoinColumn(name="statement_id")
    private PayTransactionStatement payTransactionStatement;

}



@Data
@Entity
@Table(name = "pay_transaction_statement")
@DynamicUpdate
public class PayTransactionStatement {


     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
     @Column(name="statement_id")
     private Long statementId;

     @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy ="PayTransactionStatement")
     private List<PayMaster> payMaster;

}

最佳答案

您在PayTransactionStatement中的映射应为

 @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy ="payTransactionStatement")
 private List<PayMaster> payMaster;

09-11 06:28