You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: grails-data-hibernate5/core/src/test/groovy/org/grails/orm/hibernate/connections/DataServiceMultiDataSourceSpec.groovy
+107Lines changed: 107 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ import spock.lang.Shared
24
24
importspock.lang.Specification
25
25
26
26
importgrails.gorm.annotation.Entity
27
+
importgrails.gorm.services.Query
27
28
importgrails.gorm.services.Service
28
29
importgrails.gorm.transactions.Transactional
29
30
importorg.grails.datastore.gorm.GormEnhancer
@@ -298,6 +299,93 @@ class DataServiceMultiDataSourceSpec extends Specification {
Copy file name to clipboardExpand all lines: grails-test-examples/hibernate5/grails-data-service-multi-datasource/grails-app/services/example/ProductService.groovy
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@
19
19
20
20
packageexample
21
21
22
+
importgrails.gorm.services.Query
22
23
importgrails.gorm.services.Service
23
24
importgrails.gorm.transactions.Transactional
24
25
@@ -45,4 +46,13 @@ abstract class ProductService {
45
46
abstractProductfindByName(Stringname)
46
47
47
48
abstractList<Product>findAllByName(Stringname)
49
+
50
+
@Query("from ${Product p} where $p.name = $name")
51
+
abstractProductfindOneByQuery(Stringname)
52
+
53
+
@Query("from ${Product p} where $p.amount >= $minAmount")
Copy file name to clipboardExpand all lines: grails-test-examples/hibernate5/grails-data-service-multi-datasource/src/integration-test/groovy/functionaltests/DataServiceMultiDataSourceSpec.groovy
+46Lines changed: 46 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -131,4 +131,50 @@ class DataServiceMultiDataSourceSpec extends Specification {
131
131
found.size() ==2
132
132
found.every { it.name =='Duplicate' }
133
133
}
134
+
135
+
void"@Query find-one routes to secondary datasource"() {
0 commit comments