2023-04-06

[Solved] - object to JSON string exception


Relevant tags:
  1. Spring Boot 2.7.6
  2. JUnit 5
  3. JPA
 

Error Message:

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.yourcompany.entity.Table$HibernateProxy$3enmhWuU["hibernateLazyInitializer"])


Reference URL: https://stackoverflow.com/a/67354659/6462295

Adding annotation below to your entity.

@com.fasterxml.jackson.annotation.JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
















No comments:

Google Referrals