1
我必須在@OneToMany realtion中的實體。 我試圖從我的實體獲取unitPrice時出現錯誤。有誰能幫我解決這個問題嗎?Spring MVC NumberFormatException
我的實體:
@Entity
@Table(name="Product")
public class Product {
@Id
@GeneratedValue
private int idProduct;
private String status;
private String name;
@OneToMany(mappedBy = "product")
private List <Repository> repository;
@Entity
@Table(name="Repository")
public class Repository {
@Id
private int idRepository;
private int quantity;
private double unitPrice;
@ManyToOne
private Product product;
觀點:
<c:forEach items="${products.repository}" var="product">
<p>${product.unitPrice}</p>
</c:forEach>
錯誤:
java.lang.NumberFormatException: For input string: "repository"
你是否試圖顯示產品列表?可以將控制器代碼發佈到設置產品對象的位置 –