JPA query for getting the whole tree

前端 未结 2 1649
感情败类
感情败类 2021-01-12 03:01

I have a class which models all categories and they can be ordered hierarchically.

@Entity
@Table(name=\"categories\")
public class Category {
    @Id
    @G         


        
2条回答
  •  醉酒成梦
    2021-01-12 03:24

    The short answer is; no there isn't a standard way to do this.

    You have to use native sql.

    You may be able to extend the Oracle Hibernate Dialect and add some user function/extension to get hibernate to generate PRIOR or CONNECT BY clauses, but this will prevent your app from being strict JPA and database independent.

提交回复
热议问题