I have this configuration in my application.yml
---
hibernate:
cache:
queries: false
use_second_level_cache: false
use_query_cache: false
dataSource:
pooled: true
jmxExport: true
driverClassName: com.mysql.cj.jdbc.Driver
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
username: root
password: ""
environments:
development:
pathFiles: C://pw-inventory
dataSource:
dbCreate: update
url: jdbc:mysql://localhost:3306/inventory_dev
dataSources:
two:
dbCreate: update
url: jdbc:mysql://localhost:3306/pw-security
And I have this class
class Test {
String a
String b
static mapping = {
datasource('two')
}
}
The table for test is created in two dataSource, but when I try to use Test.list([:]) and Test.two.list([:]) but I get this error.
Caused by: org.hibernate.HibernateException: No Session found for current thread