I have entity say Entity1 which has 1 to many relationship with Entity 2 & Entity 3.
Can I use criteria API so that conditionally when i fetch Entity 1 I fetch on Entity 2 but dont fetch Entity 3
I have entity say Entity1 which has 1 to many relationship with Entity 2 & Entity 3.
Can I use criteria API so that conditionally when i fetch Entity 1 I fetch on Entity 2 but dont fetch Entity 3
If it's happening while you convert to JSON — I would use SELECT NEW
queries with approrpiate DTO constructor. This way you'll get as much flexibility as you need.