leopinho opened a new issue, #14357:
URL: https://github.com/apache/grails-core/issues/14357

   If I add "implements MultiTenancy" to the domain class, it tries to use 
default datasource instead of the one defined in the datasource mapping field 
and then it returns a table not found error.
   
   If I remove "implements MultiTenant"  or remove the multiple databases 
setup, everything works fine.
   
   ```
   class SystemTransaction implements MultiTenant<SystemTransaction> {
        static mapping = {
                 datasource 'accountTransaction'
   
   18:51:05.0222 [http-nio-8080-exec-9] DEBUG o.s.j.d.DataSourceUtils - 
Fetching JDBC Connection from DataSource
   18:51:05.0239 [http-nio-8080-exec-9] DEBUG o.h.e.j.s.SqlExceptionHelper - 
could not extract ResultSet [n/a]
   java.sql.SQLSyntaxErrorException: Table 'gaming.system_transaction' doesn't 
exist
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
        at 
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at 
com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916)
        at 
com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:972)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at 
org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:118)
        at jdk.proxy2/jdk.proxy2.$Proxy153.executeQuery(Unknown Source)
        at 
org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:57)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:2322)
        at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:2075)
        at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:2037)
        at org.hibernate.loader.Loader.doQuery(Loader.java:956)
        at 
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:357)
        at org.hibernate.loader.Loader.doList(Loader.java:2868)
        at org.hibernate.loader.Loader.doList(Loader.java:2850)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2682)
        at org.hibernate.loader.Loader.list(Loader.java:2677)
        at 
org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109)
        at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1917)
        at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:370)
        at 
org.grails.orm.hibernate.query.AbstractHibernateCriteriaBuilder.invokeMethod(AbstractHibernateCriteriaBuilder.java:1699)
        at 
org.grails.orm.hibernate.query.AbstractHibernateCriteriaBuilder.list(AbstractHibernateCriteriaBuilder.java:1570)
        at 
org.grails.datastore.mapping.query.api.BuildableCriteria$list$0.call(Unknown 
Source)
   
   ```


-- 
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]

Reply via email to