1

I am working with the hibernate >5.2.10.Final and in that using the FETCH JOIN to eagerly load the inner entities.

@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "XYX", joinColumns = @JoinColumn(name = "TT"), inverseJoinColumns = @JoinColumn(name = "TT")) @Fetch(FetchMode.JOIN) private Set<PWR> pwrs; 

As the FetchType is set to Lazy, and FetchMode to JOIN, in the related query the pwrs are getting loaded eagerly.

So, my question is shall we not user FetchType if we are using the FetchMode as JOIN?

1 Answer 1

3

@Fetch(FetchMode.JOIN) will override @OneToMany(fetch = FetchType.LAZY) you can't use both together.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.