Try the following (I can't test it since I don't use Spring):
System.out.println(sessionFactory.getConfiguration().getProperty("hibernate.jdbc.batch_size"))
Matt Solnit
2008-09-19 22:34:55
Try the following (I can't test it since I don't use Spring):
System.out.println(sessionFactory.getConfiguration().getProperty("hibernate.jdbc.batch_size"))
On the versions of Hibernate that I've checked, getConfiguration is not a public method of SessionFactory. In a few desperate cases, I've cast a Session or SessionFactory into its underlying implementation to get at some values that weren't publicly available. In this case that would be:
((SessionFactoryImplementor)sessionFactory).getSettings().getJdbcBatchSize()
Of course, that's dangerous because it could break if they change the implementation. I usually only do this for optimizations that I can live without and then wrap the whole thing in a try/catch Throwable block just to make sure it won't hurt anything if it fails. A better idea might be to set the value yourself when you initialize Hibernate so you already know what it is from the beginning.