没有缓存的EclipseLink QueryException
问题描述:
我关闭了EclipseLink缓存,因为我在外部修改数据,不想手动刷新所有内容。显然,这是关掉缓存persistence.xml中避免对象的身份问题的正确方法是:没有缓存的EclipseLink QueryException
<properties>
<property name="eclipselink.cache.shared.default" value="false"/>
</properties>
和这里的例外:
Exception [EclipseLink-6094] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.QueryException
Exception Description: The parameter name [patient_id] in the query's selection criteria does not match any parameter name defined in the query.
Query: ReadAllQuery(name="file:/C:/dev/repsitory/trunk/java/server/myapp-server/myapp-server-ear/target/gfdeploy/au.com.myapp_myapp-server-ear_ear_1.0-SNAPSHOT/myapp-server-ejb-1.0-SNAPSHOT_jar/_myappPU590288694" referenceClass=PatientRecord sql="SELECT active, new_patient, patient_id_external, rank, patient_id, clinic_system_id FROM postgres.myapp.patient_record WHERE (patient_id = ?)")
我甚至无法理解的异常信息。它正在讨论查询中的参数名称,但是JDBC参数未被命名。
任何想法如何解决这个问题而无需重新开启缓存?
答
事实证明,我创建了一个PatientRecord
的实例,其中包含一个或两个分离对象(从PatientRecord
的角度来看多对一)。这不是缓存问题,因为这些对象永远不会分离。
我先合并了对象,然后才起作用。