We can see that other than the declared fields Grails created three more fieldsid : Auto increment field, used as an identifier and managed by Grails itselfversion : Used for optimistic locking, increments each time when object is updatedclass : Discriminator column used to identify what specific type of blog is associated with given row e.g; com.intelligrape.example.TextBlog

There is a drawback with this approach, as you can see in the table, column text_content and content fields are nullable true although we have defined them as nullable false in domain class. Consequence of storing all kind of blog data in single table is that we can’t have non nullable columns in sub classes but because of single table, joins are not fired and our queries will be faster. Second disadvantage could be the long discriminator, which makes it difficult to read the data of a particular class in sql.

If you dont like having single table for all the data, Grails give you freedom to create multiple tables for each class. You just need to add the following mapping block in base class

static mapping = {
tablePerHierarchy false
}

Now you can see three different tables for each class. But the major drawback in this approach is whenever you save the instance of sub-class it executes two queries for save like following