Any hint or help would be greatly appreciated it. I am using Java 17 and jpa with spring boot.
I get the following error: nested exception is
org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: For input string: "PARENT"; nested exception is com.fasterxml.jackson.databind.JsonMappingException: For input string: "PARENT" (through reference chain: com.bank.account.model.ChoreEntity["createUserId"]->com.bank.account.model.UserEntity["role"]->com.bank.account.model.RoleEntity$HibernateProxy$LSkoyC50["roleName"])
ChoreEntity.java:
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@ManyToOne(fetch = FetchType.EAGER, optional = false)
@JoinColumn(name = "create_user_id", nullable = false)
@OnDelete(action= OnDeleteAction.CASCADE)
private UserEntity createUserId;
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@ManyToOne(fetch = FetchType.EAGER, optional = false)
@JoinColumn(name = "assign_user_id", nullable = false)
@OnDelete(action= OnDeleteAction.CASCADE)
private UserEntity assignUserId;
Hibernate:
insert
into
chore
(amount, chore_status_id, create_user_id, name, chore_id)
values
(?, ?, ?, ?, ?)
In this posting: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor
In the ChoreEntity.java I added based on the above stackoverflow: @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
In the application.properties file I also added: spring.jackson.serialization.fail-on-empty-beans=false