goglnu.blogg.se

Gorm save method map of parameters
Gorm save method map of parameters




gorm save method map of parameters

Grails automatically binds a Hibernate session to the currently executing request. If you are coming from a background of using ActiveRecord or iBatis/MyBatis, Hibernate's "session" model may feel a little strange. You could also model the collection as a Hibernate Bag as described above.Ī key thing to remember about Grails is that under the surface Grails is using Hibernate for persistence. For example using the list method on the Content super class will return all subclasses of Content:ĭef book = new Book(title: "New Grails Book") The upshot of inheritance is that you get the ability to polymorphically query.

gorm save method map of parameters

In general our advice is if you're going to use inheritance, don't abuse it and don't make your inheritance hierarchy too deep. However, excessive use of inheritance and table-per-subclass can result in poor query performance due to the use of outer join queries. An alternative is to use table-per-subclass which can be enabled with the ORM DSL Table-per-hierarchy mapping has a down side in that you cannot have non-nullable properties with inheritance mapping. In the above example we have a parent Content class and then various child classes with more specific behaviour.Īt the database level Grails by default uses table-per-hierarchy mapping with a discriminator column called class so the parent class ( Content) and its subclasses ( BlogEntry, Book etc.), share the same table.






Gorm save method map of parameters