I have a userAccount entity mapped with a country entity . The country mapping in UserAccount class is like this
@ManyToOne(fetch=FetchType.EAGER) @Fetch(FetchMode.JOIN) @JoinColumn(name="f_country_id", nullable=true, insertable=false, updatable=false) private Country country;
Even there is fetchmode defined as Join, hibernate fires a separate SQL Select to fetch countries.
Remove the fetch=FetchType.EAGER
. Eager fetching triggers cascading select statements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With