Home JPA not flushes before native query with FlushModeType.AUTO
Reply: 1

JPA not flushes before native query with FlushModeType.AUTO

Oleg Surkov
Oleg Surkov Published in 2018-01-11 21:38:02Z

In our project we use hibernate 5.0.12 and Spring data Jpa.I found that jpa does not invoke flush before native query.But in JPA specification i read that with FlushModeType.AUTO flush() invokes before every query(JPQL or native SQL).i guess its problem in hibernate an hibernates version.Could someone clarify this problem?We have a lot of problem with this issue.

Vlad Mihalcea
Vlad Mihalcea Reply to 2018-01-12 02:22:24Z

It's all explained in this article.

Hibernate AUTÓ flushing does not trigger for native SQL queries. Since 5.2, it all depends on how you bootstrap Hibernate. A JPA bootstrap will yield the JPA behaviour which triggers the flush prior to any query while a native bootstrap will not.

For older Hibernate versions, even for JPA bootstraps it behaves as the legacy flush mode.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.329322 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO