This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with multiple data sources in mybatis+spring

 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I am trying to configure 2 data sources in my project. I wrote thisWhen I try to execute a query it is giving me the following exceptionLater I came to know that the problem is with having multiple data sources. I removed the first data source and the associated sqlSessionFactory. Then I was able to run test case. If I include both then I am getting this error.

Can anyone please tell me how to fix this?
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not used myBatis (used it on a project back when it was iBatis) so I am not an expert but it looks like that error occurs when the below 3 names don't match, so your problem may not be a problem so much with multiple datasources but with the naming on one of them.

Verify this:

The three names that have to match:
- interface = xxx.yyy.zzz.mappers.SettingMapper.class
- mapper file = /xxx/yyy/zzz/mappers/SettingMapper.xml
- mapper namespace = xxx.yyy.zzz.mappers.SettingMapper


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic