我是java和数据实体的新手,我得到了,"异常描述:[class com.store.Product]和[class com.store.Cart]之间遇到了不兼容的映射。 "错误,不知道为什么(显然)。
我的映射如下:
Product.java
@Basic(optional = false)
@NotNull
@Column(name = "P_QTY")
private Integer pQty;
@Column(name = "P_PRICE")
private BigDecimal pPrice;
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "P_ID")
private String pId;
@Size(max = 10)
@Column(name = "P_NAME")
private String pName;
@Size(max = 20)
@Column(name = "P_DESC")
private String pDesc;
@OneToMany(mappedBy = "pId")
Cart.java
@Id
@Basic(optional = false)
@NotNull
@Column(name = "C_ID")
private String cId;
@Basic(optional = false)
@NotNull
@Column(name = "C_QTY")
private Integer cQty;
@Column(name = "C_PRICE")
private Double cPrice;
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 10)
@JoinColumn(name = "P_ID", referencedColumnName = "P_ID")
@ManyToOne
private String pId;
有什么想法吗?就像我说的那样,我是数据实体的新手,并且已经做了足够的阅读以使我自己感到困惑,所以我为我的任何和所有白痴道歉。
提前致谢。