Has-many é desaconselhável quando há muitos registros?
07/03/2016 20:17
? “hasMany = [visits: Visit]” creates a Set(org.hibernate.collection.PersistentSet) in Library – the “inverse”Espantou-me bastante o fato que Adding to the Set requires loading all instances from the database to
collection in traditional Hibernate
? Adding to the Set requires loading all instances from the database to
guarantee uniqueness, even if you know the new item is unique
? Likewise for a mapped List – Hibernate pulls the entire collection to
maintain the correct order, even if you're adding to the end of the list
? In traditional Hibernate you could map the collection as a Bag, which
is just a regular Collection with no ordering or uniqueness guarantees,
but Grails doesn't support Bags
Para se registrar, clique aqui.