Thanks very much for the reply Max.
I was actually wrong with my previous message, this is what it really is..
Performing query.list() does listen to the cache and performing query.scroll() does not.
Here is a simple little example:
Code:
System.out.println("I'm checking the first query..");
Query query = getNamedQuery(QUERY_MESSAGE_BOX_MESSAGES, messageBox
.getId());
query.setCacheable(true);
query.list();
System.out.println("I'm checking the second query..");
query = getNamedQuery(QUERY_MESSAGE_BOX_MESSAGES, messageBox
.getId());
query.setCacheable(true);
query.scroll();
And, here is the output:
Code:
16:10:58,779 INFO [STDOUT] I'm checking the first query..
16:11:02,092 INFO [STDOUT] I'm checking the second query..
16:11:05,561 INFO [STDOUT] Hibernate: select message0_.message_id as message_id, case when message0__1_.voice_message_id is not null then 1 when message0__2_.email_message_id is not null then 2 when message0_.message_id is not null then 0 end as clazz_, message0_.status as status25_, message0_.created_date as created_3_25_, message0_.storage_size as storage_4_25_, message0_.message_box_id as message_5_25_, message0__1_.message_length as message_2_26_, message0__1_.from_phone_number as from_pho3_26_, message0__2_.text_data as text_data27_, message0__2_.from_address as from_add3_27_, message0__2_.from_name as from_name27_, message0__2_.subject as subject27_, message0__2_.is_html as is_html27_ from message message0_ left outer join voice_message message0__1_ on message0_.message_id=message0__1_.voice_message_id left outer join email_message message0__2_ on message0_.message_id=message0__2_.email_message_id, message_box messagebox1_ where (message0_.message_box_id=? )and((messagebox1_.greeting_id is null and message0_.message_box_id=messagebox1_.message_box_id)or(messagebox1_.greeting_id<>message0_.message_id and message0_.message_box_id=messagebox1_.message_box_id)) order by message0_.created_date desc