Grails 'withTransaction' with an alternate data source

Trying to figure out how to open a transaction with an alternative data source in grails. I have the following data installed:

dataSource {
    dbCreate = "update"
    url = "jdbc:h2:mem:testDb;MVCC=TRUE"
}

dataSource_ALT {
   dbCreate = "update"
   url = "jdbc:h2:mem:altDb;MVCC=TRUE"
}

I can do this with the default dataSource ...

Foo.withTransaction { status ->
    //...
}

But when I try to do this using the ALT dataSource, I get an exception - "No transactionManager bean configured" ...

Foo.ALT.withTransaction { status ->
   //...
}

Is there a way to start a transaction using a different data source? I did some operations and could not find much.

Thank!

+5
source share
1 answer

@Raphael . Transaction, . , , . Spring beans something transactionManager_ALT ( ). , , GormStaticApi.

. :

Foo["ALT"].transactionManager = transactionManager_ALT

, , , , .

0

All Articles