java - jOOQ and Caching? -
i considering moving hibernate jooq not sure if can without caching. hibernate has first- , second-level cache. know jooq have support reusing prepared statements.
will have take care of caching on own if use jooq?
query caching / result caching:
i'm mentioning this, because kind of cache also possible hibernate, , might make sense under circumstances.
in hibernate, query cache works closely second-level cache. in jooq, can implement query cache intercepts queries using jooq visitlistener
api. there blog articles topic:
there better support type of cache in future (not in jooq 3.7, yet), kind of cache belongs in sql api. note jdbc driver might support kind of cache - e.g. ojdbc does.
first-level caching:
the idea behind hibernate's first level cache doesn't make sense more sql-oriented api jooq. sql highly complex language works between persisted entities, , client representation of same entities. means once use sql, create ad-hoc tuples have nothing original entity representation of data.
in other words: first-level caching thing possible if limit functionality , scope of query language, , if take control on all database interactions, way hibernate it. jooq expressly doesn't that.
second-level caching:
the second-level cache in hibernate cache useful master data , similar types of data fetching data database hardly ever makes sense, data doesn't change.
there no reason @ all, why orm should implement kind of cache, short of convenience in simple cases. in many cases, you're better off annotating service method @cacheable
, e.g. documented here on spring page. cache on higher layer on orm / query layer, able correlate caching more tightly business logic.
Comments
Post a Comment