Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Setting allowOutOfTransactionUpdateOperations flag in 5.2
PostPosted: Sat Jun 03, 2017 7:14 am 
Newbie

Joined: Thu May 11, 2017 6:43 am
Posts: 13
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?


Top
 Profile  
 
 Post subject: Re: Setting allowOutOfTransactionUpdateOperations flag in 5.2
PostPosted: Sat Jun 03, 2017 1:40 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1385
Why would you want to update outside of a transaction? The JPA spec disallows this behavior, and this is for very good reasons. You are going to work in auto-commit mode and won't benefit from the atomic unit of work.

Sounds like a code smell to me.

Anyway, if you really need to use such a feature, then you could the `hibernate.allow_update_outside_transaction` which is documented in the Hibernate User Guide.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.