In a Spring 3 application, the controller calls JpaCollectorManager with calls to JpaCollectorInfoDao to get a list that is defined using the native query. The query calls two separate tables that use sql and jpql, because I need to use the postgresql function not implemented in jpql. When the controller tries to write a list, I get the following error message:
Exception [EclipseLink-6007] (Eclipse Persistence Services - 2.1.2.v20101206-r8635): org.eclipse.persistence.exceptions.QueryException Exception Description: A handle to [CollectorInfo] is missing.
Query: ReadAllQuery (referenceclass = CollectorInfo sql = "select different ON (col.collector_id, pst.process_source_type) col. *, Pst.process_source_timestamp, pst.process_source_type from perform_schema.collector col join perform_schema.process_setstcollectset colsetset.collectstset plect.setlect colsetstset. collector_id order by col.collector_id, pst.process_source_type, pst.process_source_timestamp desc ")
The Java controller has the following call:
List<CollectorInfo> ps = this.collectorInfoManager.getLatestCollectorInfo();
JpaCollectorInfoManager.java has the following:
public List<CollectorInfo> getLatestCollectorInfo() { return collectorInfoDao.getLatestCollectorInfo(); }
JpaCollectorInfoDao.java:
@Override @Transactional public List<CollectorInfo> getLatestCollectorInfo() { Query query = entityManager.createNativeQuery( ( "select distinct ON ( col.collector_id," + "pst.process_source_type ) " + "col.*," + "pst.process_source_timestamp," + "pst.process_source_type " + "from perform_schema.collector col " + "join perform_schema.process_set pst " + "on pst.collector_id = col.collector_id " + "order by col.collector_id, " + "pst.process_source_type," + "pst.process_source_timestamp desc " ), CollectorInfo.class ); return ( (List<CollectorInfo>) query.getResultList() ); }
There is no @Entity value defined in the CollectorInfo class. If I set the @Entity value, then it will tell me that the table cannot be resolved (which is true since there is no actual table). I tried all kinds of permutations and it seems I canโt make this needle thread.
source share