我尝试将数组列表数据放入dto模式,但出现如下错误
导致原因:org.hibernate.mappingexception:无法确定以下列的类型:[org.hibernate.mapping.column(billingdetailslist)]
查询
@Query("select new BillingDetailsDTO (b.id,b.billingDetails) "
+ "from Billing2 b "
+ "where b.id = :billingId")
List<BillingDetailsDTO> selectBillingDetails(Integer billingId);
dto模型
@Entity
public class BillingDetailsDTO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer billingId;
private List<CustomBillingDetails2> billingDetailsList;
public Integer getBillingId() {
return billingId;
}
public List<CustomBillingDetails2> getBillingDetails() {
return billingDetailsList;
}
public BillingDetailsDTO(Integer billingId, List<CustomBillingDetails2> billingDetailsList) {
super();
this.billingId = billingId;
this.billingDetailsList = billingDetailsList;
}
}
custombillingdetails2类
@Entity
public class CustomBillingDetails2 {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Integer createdBy;
private Calendar createdDate;
private Integer updatedBy;
private Calendar updatedDate;
private Integer active;
private Double qty;
private Double rate;
private Double amount;
private Double discount;
private Integer billingId;
@OneToOne
@JoinColumn(name = "testId")
private LabTest1 labTest;
@OneToOne
@JoinColumn(name = "subtestId")
private LabSubTest labSubTest;
public Integer getBillingId() {
return billingId;
}
public void setBillingId(Integer billingId) {
this.billingId = billingId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public Calendar getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Calendar createdDate) {
this.createdDate = createdDate;
}
public Integer getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(Integer updatedBy) {
this.updatedBy = updatedBy;
}
public Calendar getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Calendar updatedDate) {
this.updatedDate = updatedDate;
}
public Integer getActive() {
return active;
}
public void setActive(Integer active) {
this.active = active;
}
public LabTest1 getLabTest() {
return labTest;
}
public void setLabTest(LabTest1 labTest) {
this.labTest = labTest;
}
public LabSubTest getLabSubTest() {
return labSubTest;
}
public void setLabSubTest(LabSubTest labSubTest) {
this.labSubTest = labSubTest;
}
public Double getQty() {
return qty;
}
public void setQty(Double qty) {
this.qty = qty;
}
public Double getRate() {
return rate;
}
public void setRate(Double rate) {
this.rate = rate;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public Double getDiscount() {
return discount;
}
public void setDiscount(Double discount) {
this.discount = discount;
}
}
billing2表格模态类
@Entity
@Table(name = "\"tbl_billing\"")
public class Billing2 {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Integer createdBy;
private Calendar createdDate;
private Integer updatedBy;
private Calendar updatedDate;
private Integer active;
private Double totalAmount;
private Double totalDiscount;
private Integer isOnline;
private String collectedFrom;
private String resultCollectDateTime;
private Integer doctorId;
public Integer getDoctorId() {
return doctorId;
}
public void setDoctorId(Integer doctorId) {
this.doctorId = doctorId;
}
@OneToOne
@JoinColumn(name = "patientId")
private Patient patients;
@OneToMany
@Where(clause = "active=1")
@JoinColumn(name = "billingId", nullable = false, unique = true, insertable = false, updatable = false)
private List<BillingDetails2> billingDetails = new ArrayList<>();
public Integer getId() {
return id;
}
public List<BillingDetails2> getBillingDetails() {
return billingDetails;
}
public void setBillingDetails(List<BillingDetails2> billingDetails) {
this.billingDetails = billingDetails;
}
public Patient getPatients() {
return patients;
}
public void setPatients(Patient patients) {
this.patients = patients;
}
public Double getTotalAmount() {
return totalAmount;
}
public String getResultCollectDateTime() {
return resultCollectDateTime;
}
public void setResultCollectDateTime(String resultCollectDateTime) {
this.resultCollectDateTime = resultCollectDateTime;
}
public String getCollectedFrom() {
return collectedFrom;
}
public void setCollectedFrom(String collectedFrom) {
this.collectedFrom = collectedFrom;
}
public Integer getIsOnline() {
return isOnline;
}
public void setIsOnline(Integer isOnline) {
this.isOnline = isOnline;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public Calendar getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Calendar createdDate) {
this.createdDate = createdDate;
}
public Integer getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(Integer updatedBy) {
this.updatedBy = updatedBy;
}
public Calendar getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Calendar updatedDate) {
this.updatedDate = updatedDate;
}
public Integer getActive() {
return active;
}
public void setActive(Integer active) {
this.active = active;
}
public void setTotalAmount(Double totalAmount) {
this.totalAmount = totalAmount;
}
public Double getTotalDiscount() {
return totalDiscount;
}
public void setTotalDiscount(Double totalDiscount) {
this.totalDiscount = totalDiscount;
}
}
BillingDetails 2 entity class
@Entity
@Table(name = "\"tbl_billing_details\"")
public class BillingDetails2 {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Integer createdBy;
private Calendar createdDate;
private Integer updatedBy;
private Calendar updatedDate;
private Integer active;
private Double qty;
private Double rate;
private Double amount;
private Double discount;
private Integer billingId;
@OneToOne
@JoinColumn(name = "testId")
private LabTest1 labTest;
@OneToOne
@JoinColumn(name = "subtestId")
private LabSubTest labSubTest;
public Integer getBillingId() {
return billingId;
}
public void setBillingId(Integer billingId) {
this.billingId = billingId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public Calendar getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Calendar createdDate) {
this.createdDate = createdDate;
}
public Integer getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(Integer updatedBy) {
this.updatedBy = updatedBy;
}
public Calendar getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Calendar updatedDate) {
this.updatedDate = updatedDate;
}
public Integer getActive() {
return active;
}
public void setActive(Integer active) {
this.active = active;
}
public LabTest1 getLabTest() {
return labTest;
}
public void setLabTest(LabTest1 labTest) {
this.labTest = labTest;
}
public LabSubTest getLabSubTest() {
return labSubTest;
}
public void setLabSubTest(LabSubTest labSubTest) {
this.labSubTest = labSubTest;
}
public Double getQty() {
return qty;
}
public void setQty(Double qty) {
this.qty = qty;
}
public Double getRate() {
return rate;
}
public void setRate(Double rate) {
this.rate = rate;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public Double getDiscount() {
return discount;
}
public void setDiscount(Double discount) {
this.discount = discount;
}
}
自定义帐单明细2将其与帐单明细2实体类相同
@Entity
public class CustomBillingDetails2 {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Integer createdBy;
private Calendar createdDate;
private Integer updatedBy;
private Calendar updatedDate;
private Integer active;
private Double qty;
private Double rate;
private Double amount;
private Double discount;
private Integer billingId;
@OneToOne
@JoinColumn(name = "testId")
private LabTest1 labTest;
@OneToOne
@JoinColumn(name = "subtestId")
private LabSubTest labSubTest;
public Integer getBillingId() {
return billingId;
}
public void setBillingId(Integer billingId) {
this.billingId = billingId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public Calendar getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Calendar createdDate) {
this.createdDate = createdDate;
}
public Integer getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(Integer updatedBy) {
this.updatedBy = updatedBy;
}
public Calendar getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Calendar updatedDate) {
this.updatedDate = updatedDate;
}
public Integer getActive() {
return active;
}
public void setActive(Integer active) {
this.active = active;
}
public LabTest1 getLabTest() {
return labTest;
}
public void setLabTest(LabTest1 labTest) {
this.labTest = labTest;
}
public LabSubTest getLabSubTest() {
return labSubTest;
}
public void setLabSubTest(LabSubTest labSubTest) {
this.labSubTest = labSubTest;
}
public Double getQty() {
return qty;
}
public void setQty(Double qty) {
this.qty = qty;
}
public Double getRate() {
return rate;
}
public void setRate(Double rate) {
this.rate = rate;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public Double getDiscount() {
return discount;
}
public void setDiscount(Double discount) {
this.discount = discount;
}
}
暂无答案!
目前还没有任何答案,快来回答吧!