1
votes

I'm using GORM standalone, like described here:

https://gist.github.com/graemerocher/c25ec929d9bcd1adcbea

what I need to know, how can I pass gorm specific parameters to this kind of configuration? For example in standart grails-app I can configure GORM with Config.groovy and write there parameters like:

grails.hibernate.cache.queries=true
grails.gorm.default.mapping = {
version false
autoTimestamp false }

Where can I pass these parameters in standalone gorm-application? Thanks.

1
You can use a application.yml file in a resources folder, this shoudl workCodeFox

1 Answers

0
votes

In order to make the HibernateDatastoreSpringInitializer (which extends AbstractDatastoreInitializer) use the default configuration you need to create a Property resolver with your configuration and set it to the configuration property of the initializer:

PropertyResolver myConfig = ... // use a ConfigurableEnvironment f.E.
init = new HibernateDatastoreSpringInitializer(Person)
def dataSource = ...
init.configiration = myConfig
init.configureForDataSource(dataSource) 

Another way to make GORM accept your configuration is to set them as environment variables. Then GORM will read the values by using the StandardEnviroment (which is default).