3
過去幾天我一直在玩ORM緩存,有一件事讓我很困惑,即使啓用了緩存,SQL仍會記錄(當我有logSQL = true時)到控制檯。這讓我認爲緩存不起作用,我認爲hibernate並沒有創建sql,因爲它看到緩存中的對象,但是也許hibernate在檢查ehcache之前生成sql。ColdFusion ORM緩存和LogSQL
我的代碼低於只是在有人拿起我錯過的東西。 的Application.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());