You should use part.id instead of part when building croteria.
Hibernate Criteria - org.hibernate.PropertyAccessException: IllegalArgumentException
-
22-09-2022 - |
Question
I'm getting the following error: org.hibernate.PropertyAccessException: IllegalArgumentException
occurred calling getter of Part.part_id
, but I'm not able to use an instance of the part as an object.
String partId = (String)request.getParameter("partid");
Criteria partCriteria = session.createCriteria(PartFeatureVersion.class);
partCriteria.add(Restrictions.eq("part",partId ));
@Entity
@Table(name="PART_FEATURE_VERSION")
public class PartFeatureVersion {
private Part part;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="part_id")
public Part getPart() {
return part;
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow