Therefore it must know which sql statements that are sent to the database require a cache to be invalidated.If you let hibernate do all the sql stuff, it knows the statements it generates and therefore the tables that are affected.
The reason is found in this class Hibernate must decide when it should invalidate a second level cache.
Hibernate is a very sophisticated OR-Mapper and as such has some overhead for certain usage patterns or raw queries.
Through proper usage of caches (hibernates featured a L1, L2 cache and a query cache) you can get both performance and convenience if everything fits together.
So we dived into the source of the used hibernate release (the 3.3.1 bundled with grails 1.3.5) and browsed the hibernate issue tracker.
We found the issue and correlated it to the issues HHH-3339 and HHH-5210.