I work at a spring boot API. It's the first time I get this problem.
I'm loading different company objects via the findById function with the repository. All company objects are loaded correctly, expect one. This one loads a handler property of type JavassistLazyInitalizer with it. The remaining properties are all on the default value. In the handler object in the target node is the object loaded correctly how I want it.
So I found out that this is a type of hibernate lazy loading, because when I want to access a property with a getter, it works correctly.
My problem is, that I want to serialize the object with gson at the end and I get this error during serilazition process:
Attempted to serialize java.lang.Class: org.hibernate.proxy.HibernateProxy. Forgot to register a type adapter?
I understand why this error occurs. But I don't understand why only one of the different company objects is loaded lazy(or is a hibernateProxy). So what is the smartest way to avoid the hibernateProxy, respectively to serialize the object?
Thanks for your answers :)