有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Hibernate每次都准备语句

我正在使用Spring、Hibernate\JPA、MsSQlServer(PROD)和H2Db(DEV)的数据库密集型系统工作

我接到了一些时间密集的电话,这些电话也提出了很多问题。 在我的开发环境中启用Hibernate统计信息,我发现Hibernate似乎在每次执行查询时都会准备语句。下面是开发环境的Hibernate报告(这并不可怕,但在PROD中,并发环境的性能会降低很多)

 695050 nanoseconds spent acquiring 1 JDBC connections;

46807 nanoseconds spent releasing 1 JDBC connections;

**1009874 nanoseconds spent preparing 3 JDBC statements;**

351373 nanoseconds spent executing 3 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;

21867159 nanoseconds spent executing 1 flushes (flushing a total of 440 entities and 16 collections);

9618 nanoseconds spent executing 1 partial-flushes (flushing a total of 0 entities and 0 collections)

有没有办法让Hibernate重用PreparedStatements


共 (0) 个答案