javahibernatehibernate-mappingsessionfactory

Setting allowOutOfTransactionUpdateOperations property in hibernate


I am using Hibernate 5.2 and just wanted to check if there is a config property in AvailableSettings which i can use to set allowOutOfTransactionUpdateOperations to true while building a sessionFactory. By looking at the code this can get set using the sessionFactoryBuilder.allowOutOfTransactionUpdateOperations(true); but the problem is that we can get a reference of sessionFactoryBuilder only in Configuration class.

I tried referring https://docs.jboss.org/hibernate/orm/5.2/javadocs/org/hibernate/boot/SessionFactoryBuilder.html#allowOutOfTransactionUpdateOperations-boolean-

but it doesn't mention if anything is available with respect to AvailableSettings.

Is there anyone who has tried to set this property while building sessionFactory, using MetaData or some other way?

Please answer specifically to hibernate 5.2.


Solution

  • i just got this query answered from the hibernate forums in the following post https://forum.hibernate.org/viewtopic.php?f=1&t=1044395

    We can use the following setting hibernate.allow_update_outside_transaction to set the value.