[jboss-user] [JBoss Cache: Core Edition] - Why does em.persist resets the Query cache?
onur.aktas
do-not-reply at jboss.com
Sat Feb 7 22:10:00 EST 2009
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
More information about the jboss-user
mailing list