如何在Spring Boot应用程序中为所有会话设置FlushMode.ALWAYS?
在application.yml中设置此设置会很不错.
UPDATE
我在application.yml中尝试了两种方法:
spring.jpa.properties.org.hibernate.flushMode: ALWAYS
spring.jpa.org.hibernate.flushMode: ALWAYS
然而下一个代码:
Session ses = factory.openSession();
ses.setFlushMode(FlushMode.ALWAYS);
LOG.debug("!!!Session.FlushMode = " + ses.getFlushMode());
LOG.debug("!!!NewSession.FlushMode = " + factory.openSession().getFlushMode());
得到:
DEBUG 47225 --- : !!!Session.FlushMode = ALWAYS
DEBUG 47225 --- : !!!NewSession.FlushMode = AUTO
最佳答案
原文链接:https://www.f2er.com/spring/431555.html