Skip to content

Instantly share code, notes, and snippets.

@xcooper
Created September 7, 2015 03:42
Show Gist options
  • Save xcooper/c07af5939bfd6cb24a3d to your computer and use it in GitHub Desktop.
Save xcooper/c07af5939bfd6cb24a3d to your computer and use it in GitHub Desktop.
Sample groovy config for Spring Framework.
import org.springframework.orm.hibernate4.HibernateTransactionManager
import org.springframework.jdbc.datasource.embedded.*
import org.springframework.orm.hibernate4.LocalSessionFactoryBean
beans {
importBeans("classpath:META-INF/spring/cwep-popularity-storage/data-access.xml")
importBeans("classpath:META-INF/spring/cwep-popularity-storage/service.xml")
dataSource(EmbeddedDatabaseFactoryBean) {
databaseType = EmbeddedDatabaseType.H2
}
sessionFactory(LocalSessionFactoryBean) {
dataSource = dataSource
mappingLocations = "classpath:/META-INF/ormmapping/com/gss/cwep/popularity/storage/model/*.hbm.xml"
hibernateProperties = [
"hibernate.dialect": "org.hibernate.dialect.H2Dialect",
"hibernate.hbm2ddl.auto": "create",
"hibernate.hbm2ddl.import_files": "/test-data.sql",
"hibernate.show_sql": true,
"hibernate.format_sql": true,
"query.substitutions": "true 1, false 0, yes 'Y', no 'N'"
]
}
transactionManager(HibernateTransactionManager) {
sessionFactory = sessionFactory
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment