How can I setup FlushMode.ALWAYS
for all sessions in my Spring Boot app?
It would be nice to have this setting in application.yml
.
UPDATE
I tried with both in application.yml:
spring.jpa.properties.org.hibernate.flushMode: ALWAYS
spring.jpa.org.hibernate.flushMode: ALWAYS
However next code:
Session ses = factory.openSession();
ses.setFlushMode(FlushMode.ALWAYS);
LOG.debug("!!!Session.FlushMode = " + ses.getFlushMode());
LOG.debug("!!!NewSession.FlushMode = " + factory.openSession().getFlushMode());
gives:
DEBUG 47225 --- : !!!Session.FlushMode = ALWAYS
DEBUG 47225 --- : !!!NewSession.FlushMode = AUTO
You need to add the following property:
spring.jpa.properties.org.hibernate.flushMode=ALWAYS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With