Reputation: 599
I am using JPA 2.1 with Hibernate 4.3.x on Glassfish 4, also tried the suggestion listed at https://coderwall.com/p/e5fxrw still get the below error. Could some one let me know what might be the issue ?
javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.dstar.entity.PurchaseOrder.idpurchaseorder
Below is the entity code, skipped getter and setter methods:
@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;
}
Upvotes: 0
Views: 267
Reputation: 721
I had the same problem, using glassfish 4.1, hibernate 4.3.6, and injecting entity manager thru @PersistenceContext in a Stateless Session Bean, and saw some things interesting.
First, if I get the entity manager direct from the Persistence.createEntityManagerFactory("xxxxxx").createEntityManager() the problem disappear. Obviously, I don't like get things right in this way.
Change the server from glassfish 4.1 to glassfish 4, seems solve the problem too. So, at this moment, the problem looks like for me something wrong in glassfish 4.1.
Upvotes: 1