quarkus-mybatis icon indicating copy to clipboard operation
quarkus-mybatis copied to clipboard

Getting exception with xml mapper

Open spearheadOne opened this issue 2 years ago • 4 comments

I am using xml config and xml mapper. With this extension I am getting ivalid bound statement exception.

Here is xml config

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

    <typeAliases>
        <typeAlias type='org.abondar.experimental.quarkusdemo.model.Person' alias='Person'/>
    </typeAliases>
    <environments default="dev">
        <environment id="dev">
            <transactionManager type="QUARKUS">
                <property name="QUARKUS.autoCommit" value="true"/>
            </transactionManager>

            <dataSource type="QUARKUS">
                <property name="db" value="postgres"/>
                <property name="url" value="${url}"/>
                <property name="username" value="${username}"/>
                <property name="password" value="${password}"/>
            </dataSource>
        </environment>
        <environment id="test">
            <transactionManager type="JDBC">
                <property name="JDBC.autoCommit" value="true"/>
            </transactionManager>
            <dataSource type="QUARKUS">
                <property name="db" value="postgres"/>
                <property name="url" value="${url}"/>
                <property name="username" value="${username}"/>
                <property name="password" value="${password}"/>
            </dataSource>
        </environment>
    </environments>
    <mappers>
       <mapper resource="mapper.xml"/>
    </mappers>

</configuration>

Mapper stored in the same dir.

Application yml

  mybatis:
    xmlconfig:
      enable: true

spearheadOne avatar Apr 01 '23 17:04 spearheadOne

Hi @abondar24 , is it possible to share a reproducer? Then I can take a close look. Thanks!

zhfeng avatar Apr 02 '23 00:04 zhfeng

Which reproducer do you mean? From one of the issues I used this @MapperDataSource("xmlconfig") as a workaround. Isn't it supposed to work out of the box?

spearheadOne avatar Apr 09 '23 13:04 spearheadOne

So you met the issues in

  • https://github.com/quarkiverse/quarkus-mybatis/issues/147 ?

zhfeng avatar Apr 10 '23 03:04 zhfeng

Yep

spearheadOne avatar Apr 11 '23 20:04 spearheadOne