user2848031
user2848031

Reputation: 227

Hibernate Criteria - org.hibernate.PropertyAccessException: IllegalArgumentException

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;
}

Upvotes: 0

Views: 458

Answers (1)

AlexR
AlexR

Reputation: 115328

You should use part.id instead of part when building croteria.

Upvotes: 2

Related Questions