dirtbiker
dirtbiker

Reputation: 51

Grails 2.5 set datasource on service class not working

I have multiple data sources in my application and I want to be able to switch the datasource on a service class from the default one to a different one (so that it matches my Grails domain). Per the doc it states to use:

  static datasource = 'dsName'

property on the service class, which I have done. However, the mainTransactionManager is still using my default data source.

I can see in the ChainedTransactionManager that it calls:

MultiTransactionStatus mts = new MultiTransactionStatus(transactionManagers.get(0));

The 0th index inside of transactionManagers contains my default data source... so how do I ensure that it doesn't use the transaction manager that contains the default data source?

Where/when does Grails read the

static datasource = '...'

property?

Basically I just want to lineup my datasource across my services and my domains.

Upvotes: 0

Views: 225

Answers (1)

Related Questions