Regardless the ManyToOne is EAGER by default, when its
inverse relationship if
1. set to EAGER  (select a from a a;  a has the OneToManyRelation property)
or
2. set to LAZY but Eagerly Fetched by query (select ... from a a join fetch
a.OneToManyRelation )

We see unneeded joins being generated.

The issue is why generating the extraneous joins that can be optimized away.


I've looked at the code and it looks correct to me and tried various

things like making the inverse LAZY. But it always generating the

extraneous join. I've attached the entity source code.



The relationship causing problem is



@ManyToOne

@JoinColumn(name="ACCOUNT_ACCOUNTID")

private Accountejb2 account2;
ManyToOne is eager by default, so right now both sides are eager.

Reply via email to