In past projects which were using previous versions of Grails/Hibernate I have used in services funciton:
private void cleanGorm() {
def session = sessionFactory.currentSession
session.flush()
session.clear()
}
and for example during long tasks like bulk updates I have used it e.g.:
bigListToIterate.each {
if (it.id > 0 && it.id % 50 == 0) {
cleanGorm()
}
//CRUD action
}
However this is not working for Grails 4.0.1; athough no exception is thrown, the changes are still not reflected in the db.
How can I get it done?
I'm using:
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.4.0.Final"
Mysql version:
SELECT version();
'5.7.21'
If I inspect database, I can see that number of Rows in the table is increasing and Data Length of the table is increasing, however when I run MySQL query select * from table
I can not get any results until the whole function has ended.