For me, the problem was a bug in Hibernate when using non-pk relations: https://hibernate.atlassian.net/browse/HHH-7668
As a workaround, I implemented Serializable and the exception is gone
You should implement Serializable
interface.
My experience was this. I had a chain of parent/child relationships working. Then, I was forced to refactor. During the process, I failed to update all my annotations correctly. That is when I started receiving the cast to Serializable error. I implemented Serializable, and this exposed the real problems. Once everything was working, I was able to remove Serializable.
So, in answer to your question, the real problem may be in your setup, and Hibernate is trying to work around the issues by serializing certain entities. Try temporarily implementing Serializable to expose the issues, and then removing it.
The only other solution is to implement Externalizable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With