question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue
<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.

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
harawatacommented, Apr 3, 2016

Ah…there is a bug in type alias search 😝

As it’s a different problem than #15, I have created a new issue #42 . Thanks for the help!

0reactions
akacdcommented, Apr 3, 2016

@harawata It’s like this:

<!-- MyBatis begin -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  <property name="dataSource" ref="dataSource"/>
  <property name="typeAliasesPackage" value="com.thinkgem.jeesite"/>
  <property name="typeAliasesSuperType" value="com.thinkgem.jeesite.common.persistence.BaseEntity"/>
  <property name="mapperLocations" value="classpath:/mappings/**/*.xml"/>
  <property name="configLocation" value="classpath:/mybatis-config.xml"></property>
</bean>`

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found