简体   繁体   English

打印 hibernate.jdbc.batch_size

[英]Printing hibernate.jdbc.batch_size

Is there a way to print the batch_size that was set when configuring the sessionFactory's hibernate properties?有没有办法打印在配置 sessionFactory 的休眠属性时设置的 batch_size? For Example, throughout my code I can say: sessionFactory.getCurrentSession().getTransaction().getTimeout()例如,在我的代码中,我可以说: sessionFactory.getCurrentSession().getTransaction().getTimeout()

Is there a way to print the batch_size (something like this):有没有办法打印batch_size(类似这样):

sessionFactory.getCurrentSession().getTransaction().getBatchSize()

Since Hibernate 5.0 , you can get the hibernate properties using SessionFactoryOptions , which can be obtained from SessionFactory .从 Hibernate 5.0 开始,您可以使用SessionFactoryOptions获取休眠属性,该属性可以从SessionFactory获得。 No need to use reflection anymore :不再需要使用反射:

sessionFactory.getSessionFactoryOptions().getJdbcBatchSize();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM