ColdFusion ORM Caching and LogSQL
Ive been playing with ORM caching in the past few days and one thing that is confusing me a lot is the SQL is still logged (when I have logSQL = true) to the console even with caching enabled. This makes me think that caching is not working, I would 开发者_StackOverflow中文版think that hibernate doesnt create the sql since it sees the object in cache, but maybe hibernate generates the sql even before checking ehcache.
My code is below just incase someone picks up something I missed. Application.cfc
this.ormSettings.secondarycacheenabled = "true";
this.ormSettings.cacheprovider="ehcache";
this.ormSettings.logSQL=true;
then my Books cfc
component persistent="true" entityname="Books" table="db_books" cacheuse="transactional" lazy="true"
and lastly the code im using to call.
a = entityloadbypk("Books","1");
writeoutput(a.getName());
From what I've read and experienced first hand, the SQL transferred over the wire to your DBMS will always be logged regardless of whether ColdFusion ORM (Hibernate) is generating it JIT, or pulling it from cache. If anything, you could run a few benchmarks to quickly identify whether cache actually being used, or not.
精彩评论