Hi,

Why new inserted items resets the Query cache?

Query query = em.createQuery("select b from Book where id < 5");
  | query.setCacheable("org.hibernate.cacheable", true);
  | query.getResultList(); // RETRIEVES FROM DATABASE;
  | 
  | query.getResultList() // RETRIEVES  FROM CACHE -> OK!
  | 
  | Book book = new Book();
  | book.setTitle("Test 1 2 3");
  | em.persist(book);
  | System.out.println(book.getId()); // ----> For example: Returns 200
  | 
  | // Book having ID 1 is inserted before, it is not the persisted one above.
  | query.getResultList(); ---> RETRIEVES FROM DATABASE 
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4207975#4207975

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4207975
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to