我正在使用Spring Data框架!
所以我在eclipse控制台中遇到以下错误:
Exception [EclipseLink-6078] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.QueryException
Exception Description: The class of the argument for the object comparison is incorrect.
Expression: [null]
Mapping: [org.eclipse.persistence.mappings.ManyToOneMapping[customerService]]
Argument: [2]
Query: ReadAllQuery(referenceClass=ServiceItem sql="SELECT t1.id_service_item, t1.tenant_id, t1.arrival_date, t1.departure_date, t1.negociation_observations, t1.requested_destination, t1.sale_type, t1.see_in, t1.value_negotiated, t1.fk_customerService, t1.fk_destination FROM service_item t1 LEFT OUTER JOIN customer_service t0 ON (t0.id_customer_service = t1.fk_customerService) WHERE (((t1.sale_type = ?) AND (t1.fk_customerService = ?)) AND (t1.tenant_id = ?))")
org.eclipse.persistence.exceptions.QueryException.incorrectClassForObjectComparison(QueryException.java:601)
但是当我在我的数据库客户端运行查询时,查询效果很好!
答案 0 :(得分:2)
将对象(JPA实体)作为参数传递,而不是对象ID。