在我的java应用程序(使用Hibernate)中,我看到了Hibernate Metrics的以下细节
org.hibernate.engine.internal.StatisticalLoggingSessionEventListener Session Metrics {
46195 nanoseconds spent acquiring 1 JDBC connections;
0 nanoseconds spent releasing 0 JDBC connections;
148413278 nanoseconds spent preparing 1300 JDBC statements;
203780356679 nanoseconds spent executing 1300 JDBC statements;
0 nanoseconds spent executing 0 JDBC batches;
0 nanoseconds spent performing 0 L2C puts;
0 nanoseconds spent performing 0 L2C hits;
0 nanoseconds spent performing 0 L2C misses;
414686772 nanoseconds spent executing 2 flushes (flushing a total of 1376 entities and 0 collections);
325171056 nanoseconds spent executing 650 partial-flushes (flushing a total of 107052 entities and 107052 collections)
典型的代码流是使用源表中的数据为某些目标表准备数据:
我想了解一下如何找出可能导致部分冲洗的原因。
感谢
答案 0 :(得分:0)
您必须在要保留的方法中指明@Transactional注释。
答案 1 :(得分:0)
确保final [target]表在每个表中都索引有外键。这样可以减少创建的间歇收集的数量,从而减少要刷新的收集的数量。
根据我的经验,如果最终表中存在联接,它也可以创建更多的部分集合。