【发布时间】:2011-08-16 05:08:52
【问题描述】:
在过去的几天里,我一直在使用 ORM 缓存,而让我很困惑的一件事是,即使启用了缓存,SQL 仍然会记录到控制台(当我有 logSQL = true 时)。这让我觉得缓存不起作用,我认为hibernate不会创建sql,因为它看到缓存中的对象,但也许hibernate甚至在检查ehcache之前就生成了sql。
我的代码在下面,以防有人捡到我错过的东西。 应用程序.cfc
this.ormSettings.secondarycacheenabled = "true";
this.ormSettings.cacheprovider="ehcache";
this.ormSettings.logSQL=true;
然后是我的书 cfc
component persistent="true" entityname="Books" table="db_books" cacheuse="transactional" lazy="true"
最后是我用来调用的代码。
a = entityloadbypk("Books","1");
writeoutput(a.getName());
【问题讨论】:
标签: hibernate caching orm coldfusion application.cfc