-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SessionFactory bean has another name as expected #157
Comments
+1 the same issue in both versions 3.0.4 and 3.1.0 is looking for session factory by concatinating "sessionFactory" and datasource bean name, not a datasource name: String dataSourceName = getDataSourceName(dataSource)
String sessionFactoryName = "sessionFactory"
if (!isDefaultDataSource(dataSource)) {
sessionFactoryName = sessionFactoryName + '_' + dataSourceName
} so if your data source is "audit", then "getDataSourceName()" will return "dataSource_audit" as needed to get another bean, but session factory bean name will be "sessionFactory_audit", so it will fail to find "sessionFactory_dataSource_audit" Also using Grails: 3.3.9 and database-migration:3.0.4 |
just hit this one as well. pull-request targeting there it is: #164 |
when constructing the sessionFactory bean name for a secondary dataSource, just append the suffix, not the complete dataSource bean name (i.e. sessionFactory_another instead of sessionFactory_dataSource_another)
When multiple data sources are used, then dbm-gorm-diff, dbm-generate-changelog, etc. fail for the non default data sources:
For example:
We have default data source and 'another' data source in our application.yml
Running:
dbm-gorm-diff --dataSource=another
Fails with:
No bean named 'sessionFactory_dataSource_another' available
Cause:
No bean named sessionFactory_dataSource_another is registered. But list of registered beans contains sessionFactory_another.
Workaround:
We added
into grails-app/conf/spring/resources.groovy
The text was updated successfully, but these errors were encountered: