How to set up org.hibernate.org.hibernate.FlushMode for Spring boot application?

How do I configure FlushMode.ALWAYS

for all sessions in my Spring Boot application? It would be nice to have this setting in application.yml

.

UPDATE

I tried both in application.yml:

spring.jpa.properties.org.hibernate.flushMode: ALWAYS
spring.jpa.org.hibernate.flushMode: ALWAYS

      

However, the following 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

      

+3


source to share


1 answer


You need to add the following property:



spring.jpa.properties.org.hibernate.flushMode=ALWAYS

      

+2


source







All Articles