我在Glassfish 4上使用JPA 2.1和Hibernate 4.3.x,也嘗試了在https://coderwall.com/p/e5fxrw列出的建議,仍然得到以下錯誤。有人能告訴我可能是什麼問題嗎?無法通過反射來獲取字段值hibernate JPA + GF 4
javax.persistence.PersistenceException:org.hibernate.PropertyAccessException:無法通過com.dstar.entity.PurchaseOrder.idpurchaseorder
下面的反射吸氣得到一個字段的值是實體代碼,跳過getter和setter方法:
@Entity
@Table(name="purchaseorder")
@PersistenceUnit(name="dstarwarehouse",unitName="dstarwarehouse")
public class PurchaseOrder implements Serializable{
@Id @GeneratedValue(strategy=GenerationType.AUTO)
private int idpurchaseorder;
private boolean cash;
private boolean credit;
private String supplier;
private String orderedBy;
private String submittedBy;
private String approvedBy;
private Date expectedDate;
private Date creationDate;
private Date submittedDate;
private Date approvalDate;
private String purchaserName;
private double total;
@JoinColumn(name="idpurchaseorder", referencedColumnName="idpurchaseorder")
private List<Part> parts;
}
當你得到這個異常時,你到底在做什麼?請詳細說明您的問題,以便人們可以更有效地幫助您。 – jpangamarca 2014-10-26 13:31:27