Getting the ID of a one-to-many loaded object without another trip to the DB with GORM
问题 I have to GORM domains, A & B, that relate to database tables. A has a one-to-many relationship with B. Because of this, the classes look similar to: class A { B b Long id } class B { Long id } When I retrieve an instance of A the ID of the corresponding instance of B is retrieved from the database. However, when I attempt to access that ID via something like: A a = A.get(11) Long bid = a.b.id the whole object is loaded from the database. In some cases I only want the ID of B (which has