(Lazy) LEFT OUTER JOIN using the Hibernate Criteria API

前端 未结 3 1092
一生所求
一生所求 2020-12-28 15:44

I want to perform a LEFT OUTER JOIN between two tables using the Criteria API. All I could find in the Hibernate documentation is this method:

Criteria crite         


        
3条回答
  •  独厮守ぢ
    2020-12-28 16:22

    A join is in the SQL request. It can't be lazy.


    With Hibernate, to retrieve lazily this data, just exclude it from the HQL request. Then, when you access the getters on your entity (if your Session is still open), it will be loaded automatically (you don't have to write that part of the request).

提交回复
热议问题