I am using two identical JPQL NamedQueries, except that one is a COUNT. Here are the queries:
select i from IssueRingReqsBrit i where i.ringDataRequest = 'I' and i.onRingIssue = 'Y' and i.noCardIssued = 0
select COUNT(i) from IssueRingReqsBrit i where i.ringDataRequest = 'I' and i.onRingIssue = 'Y' and i.noCardIssued = 0
IssueRingReqsBrit is a view.
The first query is returning a list of 6, which is correct.
The second query, the count, return 0.
Databased being used is Oracle. Using Glassfish with Eclipselink. Shared cache mode on the PU is set to none.
Using native queries in Oracle, the correct values are returned.
Below is the code I use to execute the queries, and check the results. There is no other code between these lines, they were copy and pasted as they are in the Java.
query = em.createNamedQuery("IssueRingReqsBrit.onRingIssue_toSend_initial");
System.out.println("Size: " + query.getResultList().size() );
//ringingRequestRingIssueYesToSendInitial
query = em.createNamedQuery("IssueRingReqsBrit.onRingIssue_toSend_initial_count");
ringingRequestRingIssueYesToSendInitial = ((Long)query.getSingleResult()).intValue();
System.out.println("ringingRequestRingIssueYesToSendInitial = " + ringingRequestRingIssueYesToSendInitial);
Any suggestions are appreciated.