This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design 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