Change default table engine in Grails 1.1

07 / Jun / 2010 by Uday Pratap Singh 2 comments

Recently in our project the client had the requirement that he want each table have ‘InnoDB’ but Grails by default provided the MyIsam tables. We highly depends upon the create drop, update feature of grails and We dont want to change the table engine of every table manually.
So after reading few docs of Grail we found the clean way of changing the default engine type of grails table

We just need to do configure DataSource.groovy and add the dialect to it.

dataSource {
    pooled = true
    driverClassName = "com.mysql.jdbc.Driver"
    username = "username"
    password = "password"
    dialect = 'org.hibernate.dialect.MySQL5InnoDBDialect'
}

By adding a line we are done. This really depicts Grails is really highly configurable

Hope it helps
Uday Pratap Singh
uday@intelligrape.com
https://twitter.com/meudaypratap

Tag -

FOUND THIS USEFUL? SHARE IT

comments (2)

  1. Uday

    Hi Yorz. It is quite possible that this is from hibernate because Grails in itself uses the Hibernate. Grails provides most of the good things of Java world, its just we need to know how to use and configure them. In this blog I am just telling about how to configure dialect in grails.

    Reply
  2. Yorz

    Except that this is all about Hibernate.
    It’s nice you like Grails but this has been par for the course in Hibernate enabled Java projects for a long time.

    Reply

Leave a comment -