Hibernate Issuing select statement even if FetchMode = Join

后端 未结 4 1807
挽巷
挽巷 2021-02-01 15:41

I have a userAccount entity mapped with a country entity . The country mapping in UserAccount class is like this

@ManyToOne(fetch=FetchType.EAGER)
@Fetch(FetchMo         


        
4条回答
  •  佛祖请我去吃肉
    2021-02-01 15:57

    Satadru Biswas gave the answer in a previous comment .

    Hibernate 3.x ignores the FetchMode annotation when you use the Query interface (Session.createQuery) so in this case you have to add an INNER JOIN FETCH clause to the FROM part of your query.

    The criteria interface however will use this interface correctly.

提交回复
热议问题