This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a native query defined in an EJB entity bean of the sort SELECT * FROM EMPLOYEES WHERE JOB_ID = <variable>
I execute the query within a for loop sequentially for a different job id.
I get the results using the getResultList function .
My problem is that the list of results for all executions of the query are the same and correspond to the first job id of the loop.
Presumambly some sort of caching takes place and I don;t know how to turn it off.
Can anybody help?
This is an exerpt of my code:
Query query = em.createNativeQuery("SELECT * FROM EMPLOYEES" +
" WHERE JOB_ID="+jobId,Employeeclass);
List<Employee> empList = (List<Employee>)query.getResultList();