Olav Grønås Gjerde

profile image
Full stack system architect with passion for Unix, Java, Python and databases.
Twitter @olavgg
5 years ago

Grails GORM HQL Eager fetch

Sometimes you want to select associated objects using a single select query. Also called eager fetching.

Todo this with HQL in Grails is a simple as:

List<Sensor> sensors = Sensor.findAll("FROM Sensor s INNER JOIN FETCH s.equipmentType")