| [55] | 1 | dataSource { |
|---|
| [171] | 2 | // Open separate connections to database for every request or pool connections. |
|---|
| [148] | 3 | pooled = true |
|---|
| [55] | 4 | } |
|---|
| 5 | hibernate { |
|---|
| 6 | cache.use_second_level_cache=true |
|---|
| [178] | 7 | cache.use_query_cache=true |
|---|
| [449] | 8 | cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider' |
|---|
| [55] | 9 | } |
|---|
| [81] | 10 | |
|---|
| [174] | 11 | // dbCreate options. |
|---|
| 12 | // create-drop: Drop and re-create the database tables on restart. Deletes existing data. |
|---|
| [149] | 13 | // create: Create the database if it doesn't exist, but don't modify it if it does. Deletes existing data. |
|---|
| 14 | // update: Create the database if it doesn't exist, and modify it if it does exist. Keep data. |
|---|
| [174] | 15 | // If nothing specified then do nothing to database schema. |
|---|
| 16 | |
|---|
| [945] | 17 | def appNameLowerCase = appName.toLowerCase() |
|---|
| 18 | |
|---|
| [174] | 19 | // Environment specific settings. |
|---|
| [923] | 20 | // All production config is in external config. |
|---|
| [55] | 21 | environments { |
|---|
| [148] | 22 | development { |
|---|
| 23 | dataSource { |
|---|
| 24 | /** HSQLDB - In memory */ |
|---|
| [149] | 25 | driverClassName = "org.hsqldb.jdbcDriver" |
|---|
| 26 | username = "sa" |
|---|
| 27 | password = "" |
|---|
| [81] | 28 | dbCreate = "create-drop" |
|---|
| [504] | 29 | url = "jdbc:hsqldb:mem:devDb" |
|---|
| [148] | 30 | /** MySQL */ |
|---|
| [878] | 31 | // dialect = org.hibernate.dialect.MySQL5InnoDBDialect |
|---|
| [149] | 32 | // driverClassName = "com.mysql.jdbc.Driver" |
|---|
| [945] | 33 | // username = "${appNameLowerCase}admin" |
|---|
| 34 | // password = "${appNameLowerCase}admin" |
|---|
| [148] | 35 | // dbCreate = "create-drop" |
|---|
| [945] | 36 | // url = "jdbc:mysql://host:3306/${appNameLowerCase}_dev?autoReconnect=true&sessionVariables=storage_engine=InnoDB" |
|---|
| [148] | 37 | } |
|---|
| 38 | } |
|---|
| 39 | test { |
|---|
| 40 | dataSource { |
|---|
| 41 | /** HSQLDB - In memory */ |
|---|
| [149] | 42 | driverClassName = "org.hsqldb.jdbcDriver" |
|---|
| 43 | username = "sa" |
|---|
| 44 | password = "" |
|---|
| [148] | 45 | dbCreate = "update" |
|---|
| 46 | url = "jdbc:hsqldb:mem:devDb" |
|---|
| 47 | /** MySQL */ |
|---|
| [878] | 48 | // dialect = org.hibernate.dialect.MySQL5InnoDBDialect |
|---|
| [149] | 49 | // driverClassName = "com.mysql.jdbc.Driver" |
|---|
| [945] | 50 | // username = "${appNameLowerCase}admin" |
|---|
| 51 | // password = "${appNameLowerCase}admin" |
|---|
| [148] | 52 | // dbCreate = "update" |
|---|
| [945] | 53 | // url = "jdbc:mysql://host:3306/${appNameLowerCase}_test?autoReconnect=true&sessionVariables=storage_engine=InnoDB" |
|---|
| [148] | 54 | } |
|---|
| 55 | } |
|---|
| [923] | 56 | } |
|---|