I have two entities as shown below
@Entity
@Getter
@Setter
@Table(name = "ice_folder")
@AttributeOverride(name = "id", column = @Column(name = "folder_id"))
@Audited
public class Folder extends BaseResourceEntity {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "parent_folder")
private Folder parentFolder;
}
@Entity
@Getter
@Setter
@Table(name = "ice_folder")
@AttributeOverride(name = "id", column = @Column(name = "folder_id"))
public class FolderView extends BaseResourceEntity {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "parent_folder", insertable = false, updatable = false)
private Folder parentFolder;
}
when I fetch the records by using the FolderView, I'm getting the below infinite recursion error, can anyone tell me how to fix this and fetch the record easily. I can fetch the records only by using the FolderView.
`Infinite recursion (StackOverflowError) (through reference chain: org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["parentFolder"]->org.icedq.admin.api.v1.entity.Folder$HibernateProxy$GwYLH9jE["children"]->org.hibernate.collection.internal.PersistentSet[0]-