Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Native query always returning same data

 
Dimitris Karageorgopoulos
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

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();


 
Vladimir Galcenco
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post the loop as well? I'd like to see when and how your job id changes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic