I'm using Spring to develop my application using Hibernate and JPA as persistence API in a MySQL database. When I fetch most of my objects from the database, they have their attributes initialized with the values of the database and collections are Lazy loaded. The problem comes with an entity called Business
which is loaded as a JavassistLaziInitializer
using method find()
from EntityManager
.
If I execute a get or set method, they use the proxy and give me the values I need, but when I use @Valid
and validation annotaions, as the real values are NULL (column values, not collections), I have validation errors like @NotNull
.
I was hoping if somebody knows a method to get the columns filled with the JavassistLazyInitializer proxy values, or a method to get the proxy itself.
Note that this behaviour, as I have concerned is not a bug on hibernate because it has been reported several times as a bug but developers advices that is a normal behaviour of hibernate that happend in certain conditions.