Hibernate joining two table and fetch all records?

后端 未结 4 2081
离开以前
离开以前 2021-01-02 20:51

I have two entity class Category and Events.I need to join both the tables and fetch all records which matching the given condition

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-02 21:39

    This query should do the job:

    from Category as c
    inner join c.events as e
    where c.parentCategoryId = 1
    

    Plus you seem to have a typo (missing "d" at the end) here:

    @JoinColumn(name="category_i"))

提交回复
热议问题