just wondering if the caching would be very clever to know that SELECT * FROM ACCOUNT ORDER BY clientName and SELECT * FROM ACCOUNT ORDER BY clientNumber are the same SQL statement, just different sorting option? Or should I query for results without sorting option, and do the sorting myself?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The statement will be considered different and therefore the cache will distinguish between them. So yes, if you want it to be cached only once, you should query without the sort and sort using the Collections class with a Comparator implementation.
(The framework never parses SQL directly, which is why it works with any database.)
Cheers,
Clinton
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Not sure what you mean by that. But the answer is: yes you _can_ use multiple threads and the cache will deal with them. But caching will also work if only one thread ever uses it.
Cheers,
Clinton
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
just wondering if the caching would be very clever to know that SELECT * FROM ACCOUNT ORDER BY clientName and SELECT * FROM ACCOUNT ORDER BY clientNumber are the same SQL statement, just different sorting option? Or should I query for results without sorting option, and do the sorting myself?
Hi,
The statement will be considered different and therefore the cache will distinguish between them. So yes, if you want it to be cached only once, you should query without the sort and sort using the Collections class with a Comparator implementation.
(The framework never parses SQL directly, which is why it works with any database.)
Cheers,
Clinton
Do I need to use threading to take advantage of the the caching facility? Thanks
Hi,
Not sure what you mean by that. But the answer is: yes you _can_ use multiple threads and the cache will deal with them. But caching will also work if only one thread ever uses it.
Cheers,
Clinton