I have an entity:
public class Album extends GenericAuditedEntity {
@OneToMany(fetch = FetchType.LAZY)
private Set<Item> itemSet = new HashSet<Item>();
}
And when I start HQL as follows: em.createQuery ("select a from album a"). getResults ()
it processes many SQL queries: One for selecting data from the album table. Smth like this: select .... from Album_table; And one query for each row selected to select items. Smth like this: select .... from Item_table iwhere i.Album_id =: Album_id;
But when I run em.createQuery ("select a.id, b.id from the album a left join Item i") .getResults ()
It processes one SQL query. But this is the result of a list of some parameters that I need to put into objects manually.
HQL ? ?