jamesfredley commented on code in PR #15435:
URL: https://github.com/apache/grails-core/pull/15435#discussion_r2847115377
##########
grails-test-examples/datasources/src/integration-test/groovy/functionaltests/DatasourceSwitchingSpec.groovy:
##########
@@ -367,4 +367,90 @@ class DatasourceSwitchingSpec extends Specification {
and: "secondary books still exist"
SecondBook.withTransaction { SecondBook.countByTitleLike("Delete Me%")
} == 2
}
+
+ def "executeQuery routes to secondary datasource"() {
+ given: "books in both datasources"
+ def primaryTitle = "Primary Query ${UUID.randomUUID()}"
+ def secondaryTitle = "Secondary Query ${UUID.randomUUID()}"
+ new Book(title: primaryTitle).save(flush: true)
+ SecondBook.withTransaction {
+ new SecondBook(title: secondaryTitle).save(flush: true)
+ }
+
+ when: "executing query on secondary"
+ def results
+ SecondBook.withTransaction {
+ results = SecondBook.executeQuery("from ds2.Book where title =
:t", [t: secondaryTitle])
Review Comment:
test
##########
grails-test-examples/datasources/src/integration-test/groovy/functionaltests/DatasourceSwitchingSpec.groovy:
##########
@@ -367,4 +367,90 @@ class DatasourceSwitchingSpec extends Specification {
and: "secondary books still exist"
SecondBook.withTransaction { SecondBook.countByTitleLike("Delete Me%")
} == 2
}
+
+ def "executeQuery routes to secondary datasource"() {
+ given: "books in both datasources"
+ def primaryTitle = "Primary Query ${UUID.randomUUID()}"
+ def secondaryTitle = "Secondary Query ${UUID.randomUUID()}"
+ new Book(title: primaryTitle).save(flush: true)
+ SecondBook.withTransaction {
+ new SecondBook(title: secondaryTitle).save(flush: true)
+ }
+
+ when: "executing query on secondary"
+ def results
+ SecondBook.withTransaction {
+ results = SecondBook.executeQuery("from ds2.Book where title =
:t", [t: secondaryTitle])
Review Comment:
test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]