Skip to content

Class/TypeAlias 'Order' not found ,multi-typeAliasesPackage problem on multi-datasource? #15

Open
@chenjch

Description

@chenjch
<bean id="sqlSessionFactory1" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="DataSource1" />
    <property name="configLocation" value="classpath:mybatis-config.xml" />
    <property name="typeAliasesPackage" value="com.abc.entity.a" />
    <property name="mapperLocations" value="classpath:mapper/a/*.xml" />
</bean>

<bean id="sqlSessionFactory2" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="DataSource2" />
    <property name="configLocation" value="classpath:mybatis-config.xml" />
    <property name="typeAliasesPackage" value="com.abc.entity.b" />
    <property name="mapperLocations" value="classpath:mapper/b/*.xml" />
</bean>

every mapper xml file in mapper/a/.xml is ok
but every mapper xml file in mapper/b/
.xml have error:

<select id="selectOrder" parameterType="String" resultType="Order">
    select sql...
</select>

Class/TypeAlias 'Order' not found.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions