I have problem with MyBatis configuration within two modules. Project structure look like that:
- DB
- src
- main
- java
- VideosDAO.class
- ConnectionFactory.class
- Videos.class
- VideosMapper.class
- resources
- VideoMapper.xml
- config.xml
- java
- main
- pom.xml
- src
- MIXED
- src
- main
- java
- ArticlesDAO.class
- Articles.class
- ArticlesMapper.class
- resources
- ArticlesMapper.xml
- java
- main
- pom.xml
- src
When I have all stuff in DB module I can connect to database and execute SQL but when I want to use ConnectionFactory.class and config.xml from DB module in MIXED module it is not working.
### Error building SqlSession.
### Cause: org.apache.ibatis.builder.BuilderException: Error creating document
instance. Cause: org.xml.sax.SAXParseException; lineNumber: 24; columnNumber:
24; Premature end of file.
I think problem is in config.xml file within
<mappers>
</mappers>
I've tried all possibilities from: http://www.mybatis.org/mybatis-3/configuration.html#mappers but nothing worked :( Any ideas how config.xml should look like to allow me to use classes from other module and not duplicate them but in the same time use mapper from other module?
Some of my tries:
<mappers>
<mapper url="file:///MIXED/src/main/resources/ArticlesMapper.xml"/>
<mapper resource="VideoMapper.xml"/>
</mappers>
<mappers>
<mapper resource="MIXED/src/main/resources/ArticlesMapper.xml"/>
<mapper resource="VideoMapper.xml"/>
</mappers>