quarkiverse / quarkus-mybatis

Quarkus MyBatis Extension
Apache License 2.0
91 stars 33 forks source link

Fix #468 to support database id #471

Closed zhfeng closed 3 months ago

zhfeng commented 3 months ago

@p91paul can you check this could fix your issue by add quarkus.mybatis.database-id=h2 ? and in mybatis-config

<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <environments default="quarkus">
        <environment id="quarkus">
            <transactionManager type="JDBC"/>
            <dataSource type="QUARKUS"/>
        </environment>
    </environments>
    <databaseIdProvider type="QUARKUS_VENDOR"/>
     <mappers>
        <package name="com.example.demo"/>
    </mappers>
</configuration>

Aslo if you want to run with the SessionFactory from xml configuration, you need to add MapperDataSource

package com.example.demo;

import org.apache.ibatis.annotations.Mapper;

import io.quarkiverse.mybatis.runtime.meta.MapperDataSource;

@Mapper
@MapperDataSource("xmlconfig")
public interface DemoMapper {

    String getX();
}