Bytecode enhancement + ManyToOne + Lazy Group generate several queries instead of 1

Description

When using bytecode enhancement with a ManyToOne relation and a Lazy Group, 2 queries are executed instead of one.

Code omitted for brevity

Case 1 is fine, sql generated is :

  • select refone0_.ref_one_id as ref_one_1_3_0_, refone0_.label as label2_3_0_ from ref_one refone0_ where refone0_.bug_lazy_grp_id=?

Case 2 generate 2 queries instead of 1

  • select buglazygrp_.ref_many_1id as ref_many3_0_ from bug_lazy_grp buglazygrp_ where buglazygrp_.bug_lazy_grp_id=?

  • select refmany1x0_.ref_many_1id as ref_many1_1_0_, refmany1x0_.description as descript2_1_0_ from ref_many_1 refmany1x0_ where refmany1x0_.ref_many_1id=?

Example code provided with manual test case

Environment

None

Assignee

Unassigned

Reporter

Benoit Wiart

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure