Hibernate java.lang.ClassCastException: org.hibernate.action.EntityIdentityInsertAction cannot be cast to org.hibernate.action.EntityInsertAction
It's a bug in Hibernate. Exception is thrown when following conditions are met:
- id generation strategy is
identity
- entity is saved outside of transaction
hibernate.order_inserts
istrue
It happens because EntityIdentityInsertAction
can be added to the ActionQueue.insertions
list, whereas ActionQueue$InsertActionSorter
expects that it contains only EntityInsertAction
s.
It looks like this bug was not reported yet, so feel free to report it.
Perhaps you can change the value of hibernate.order_inserts
as a workaround.