使用查询 dsl 时发生递归错误

Recursive error occurs when using query dsl

提问人:googoo 提问时间:11/9/2023 更新时间:11/9/2023 访问量:17

问:

实体

@Entity
@Table(
    name = "voc_category"
)
data class VocCategoryEntity(
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "cate_seq", nullable = false)
    var cateSeq: Long? = null,

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "parent_cate_seq")
    var parentCategory: VocCategoryEntity? = null,

    @OneToMany(
        mappedBy = "parentCategory",
        targetEntity = VocCategoryEntity::class,
        fetch = FetchType.LAZY
    )
    var childrenCategory: List<VocCategoryEntity>? = ArrayList()
}

存储 库

val voc = query
        .selectFrom(vocCategoryEntity)
        .innerJoin(vocCategoryEntity.childrenCategory)
        .fetchJoin()
        .fetch()

Servlet.service() 在路径为 [] 的上下文中为 servlet [dispatcherServlet] 抛出异常 [处理程序调度失败:java.lang.StackOverflowError],根本原因

有错误,有解决办法吗?

我已经更改了级联和条目,但它无法正常工作

查询DSL

评论


答: 暂无答案