The Mapper conflicts with itself?

464 Views Asked by At

I have a message when trying to run the JBoss server with app with two myBatis mappers

XML fragments parsed from previous mappers already contains value for workSql

The funny moment is that the sql element workSql is in one only mapper. And exists only once. I had checked that by file searching, too.

The similar problem, in MyBatis: Errors when upgrading to 3.2.7 from 3.0.3, about the message

Mapped Statements collection already contains value for com.foo.FooDao.java

is different, for it is not about sql element, but about the whole MyBatis mapper referenced in Spring context. And the receipt for it won't work for my case, too - my mappers already have namespaces and they won't help.

1

There are 1 best solutions below

0
On

It seems that if mappers are not exactly named, the MyBatis in some situations tries to read them more than once and they conflict with themselves.

The receipt was to set all mappers in the configuration.xml file:

<mappers>
    <mapper resource="amcssz/spr/srv/main/batis/ReportsMapper.xml"/>
    <mapper resource="amcssz/spr/srv/main/batis/SprMapper.xml"/>
</mappers>

All conflicts disappeared.