If you check my code example, you will see that I'm refreshing the second session before committing. I was expecting that this would prevent the exception but it is still thrown. This is the part I don't understand. Maybe one session cannot refresh changes from another one?