Is it possible avoid using XXXMapper.xml?

41 views
Skip to first unread message

FromBasic

unread,
Nov 9, 2012, 12:21:42 PM11/9/12
to mybati...@googlegroups.com
I mean, I just want to include the MapperConfig.xml ( including connection configuration and mapper resources) and Java DAO files ( POJO java with MyBatis Anntonations)

For example, MapperConfig.xml
<settings> ...</settings> 
<environments> ... </environments>
<mappers>
     <mapper resource=" ILogin .java"/> (but not via XXXMapper.xml)
     ...
</mappers>

And in ILogin.java
public interface ILogin {
@Select("SELECT user_id, username,tribe_name, locked FROM iqu.tb_user WHERE username = #{unm} and tribe_name=#{tribe} and password=#{pwd}")
@Results(value = { @Result(property = "userId", column = "user_id"),
@Result(property = "username"),
@Result(property = "tribeName", column = "tribe_name"),
@Result(property = "locked") })
...

Thank you !

Eduardo Macarron

unread,
Nov 9, 2012, 12:54:40 PM11/9/12
to mybati...@googlegroups.com
Yep, use:

<mappers>
<mapper class="org.mybatis.builder.AuthorMapper"/>
<mapper class="org.mybatis.builder.BlogMapper"/>
<mapper class="org.mybatis.builder.PostMapper"/>
</mappers>

More details in:
http://www.mybatis.org/core/configuration.html#mappers

2012/11/9 FromBasic <grain...@gmail.com>:

FromBasic

unread,
Nov 9, 2012, 1:08:41 PM11/9/12
to mybati...@googlegroups.com
Thanks Eduardo!
It seems I must change my user manual ... Is the pdf version not the latest one?

在 2012年11月10日星期六UTC+8上午1时54分49秒,Eduardo写道:

Eduardo Macarron

unread,
Nov 9, 2012, 1:23:57 PM11/9/12
to mybati...@googlegroups.com
Seems so. You have an updated pdf in the bundle at the downloads page.

2012/11/9 FromBasic <grain...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages