1
是否可以在播放框架實體查詢中指定數據庫索引提示。JPA實體使用索引提示
我的代碼如下所示:
public static List<Transaction> findOnInactive(Date date) {
return Transaction.find(
"date = ? and account in (select d.acctNb from account d "
+ " where d.date = ? and (d.inactive = true or d.blocked = true)"
+ " group by d.acctNb)", date, date).fetch();
}
運行生成的查詢需要20秒。然而,隨着
SELECT * FROM用(INDEX(_dta_index_k1_1))交易...
手動運行相同的查詢只需要1秒。無論如何,我可以在我的JPA查詢中指定索引提示?
是的,但是這意味着我需要手動完成所有的映射回我的交易對象。我原來的查詢返回事務預填充的列表,這非常方便。 – emt14 2012-04-10 08:47:17
剛剛查看了您的代碼。讓我試試這個與指定的事務類。 – emt14 2012-04-10 08:49:35
輝煌,作品一種享受! – emt14 2012-04-10 09:09:09