Skip to content

Instantly share code, notes, and snippets.

@cdeszaq
Created July 16, 2013 17:42
Show Gist options
  • Save cdeszaq/6010906 to your computer and use it in GitHub Desktop.
Save cdeszaq/6010906 to your computer and use it in GitHub Desktop.
println("Configuring data sources")
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
jdbc.factory_class = 'net.bull.javamelody.HibernateBatcherFactory'
}
// environment specific settings
environments {
development {
println("Configuring data sources for development environment")
dataSource {
println("Using disk-based H2 db")
driverClassName = "org.h2.Driver"
dialect = "org.hibernate.dialect.H2Dialect"
username = "sa"
password = ""
url = "jdbc:h2:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
}
test {
println("Configuring data sources for test environment")
dataSource {
username = "SET ME"
password = "SET ME"
url = "SET ME"
}
}
production {
println("Configuring data sources for production environment")
dataSource {
username = "SET ME"
password = "SET ME"
url = "SET ME"
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment