Q: Is anyone using both a write and read-rep DB wi...
# questions
d
Q: Is anyone using both a write and read-rep DB with Grails and the same set of ORM definitions? We have some heavy read-only tasks (ie: reporting queries) and are not able to get an isolated transaction to actually read from our read-rep. Details in🧵
We setup our config according to specs here: https://guides.grails.org/grails4/grails-multi-datasource/guide/index.html We added the datasource ALL mapping to all Domain classes (confirming with my team they also tried
datasources([ConnectionSource.DEFAULT, 'readrep'])
)
Copy code
static mapping = {
    datasource 'ALL'
}
Then we call our reporting function to run our reporting queries using the following annotation ie:
Copy code
import grails.gorm.transactions.Transactional

@Transactional(connection = 'readrep', propagation = Propagation.REQUIRES_NEW)
void getHighlySensitivePersonalDataAndAddToPublicReportBean(User user, PublicReportBean bean)
Local traces show Hibernate referencing the reporting source but all live env tests show queries are being run against the DEFAULT source.
t
I don't have any experience with using
read-rep
datasources, or multiple datasources, but for the sake of anybody else who might be able to help you out, what version of Grails are you using?
d
Great call, thanks. Grails version
5.3.0
is the version we're testing on.