简体   繁体   English

Hibernate Criteria - org.hibernate.PropertyAccessException:IllegalArgumentException

[英]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. 我收到以下错误: org.hibernate.PropertyAccessException: IllegalArgumentException调用Part.part_id getter时发生org.hibernate.PropertyAccessException: IllegalArgumentException ,但我无法将该部件的实例用作对象。

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

在构建croteria时,您应该使用part.id而不是part。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 休眠:org.hibernate.PropertyAccessException:IllegalArgumentException - Hibernate : org.hibernate.PropertyAccessException: IllegalArgumentException org.hibernate.PropertyAccessException持续存在 - org.hibernate.PropertyAccessException on persist jComboBox给出org.hibernate.PropertyAccessException错误 - jComboBox giving org.hibernate.PropertyAccessException error 如何修复Spring Boot应用程序中的org.hibernate.PropertyAccessException:IllegalArgumentException异常 - How to fix org.hibernate.PropertyAccessException: IllegalArgumentException exception in spring boot application org.hibernate.PropertyAccessException:调用com.dms.model.Group.groupId的getter时发生了IllegalArgumentException - org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.dms.model.Group.groupId org.hibernate.PropertyAccessException:空值已分配给布尔类型的属性 - org.hibernate.PropertyAccessException: Null value was assigned to a property of boolean type org.hibernate.PropertyAccessException-如何从数据库中获取空值? - org.hibernate.PropertyAccessException - How to get a null value out of database? 为什么会出现org.hibernate.PropertyAccessException? - Why am I getting org.hibernate.PropertyAccessException? org.hibernate.PropertyAccessException,同时保持ManyToMany关系 - org.hibernate.PropertyAccessException while persisting ManyToMany relationship org.hibernate.PropertyAccessException:无法通过反射getter获取字段值 - org.hibernate.PropertyAccessException: could not get a field value by reflection getter of
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM