nordborg wrote:
Yes, transaction.commit() should commit all changes to the database. It is not apparent to me why you think it doesn't do that. Can you explain this and also answer the following questions:
1. What is going on in the rebuildModel() method? Why do you need to rebuild it?
I show a table with a lot of records, including the ones I change in this code. RebuildModel gets all records from the db and fills this table.
Because some records are changed, the table needs to be updated.
nordborg wrote:
Are you doing additional changes outside the already committed transaction?
All changes are done before transaction.commit(), but rebuildModel doesn't always show the latest changes (sometimes it does, or partially).
So this means the changes in the db are not done by transaction.commit(), so I quess it's done on session.flush().
nordborg wrote:
2. Why do you call session.flush() after the rebuilding?
To close my sessions I use a method which does flush and close. After rebuilModel() this method is called.
Adding session.flush() before rebuildModel() doesn't change anything.
Edit: If I close the session before rebuildModel() and open another one to use in rebuildModel(), it does work.