mybatis / mybatipse

Eclipse plugin adding support for MyBatis SQL Mapper Framework.
Eclipse Public License 1.0
332 stars 91 forks source link

Transform @Results to <resultMap /> #67

Closed kiru closed 7 years ago

kiru commented 7 years ago

Hello @harawata ,

Thank you for this plugin.

I have tried to use your plugin to transform from Java Annotations to XML Annotations, but the “@Result" are not transformed at all.

This is the method I have tried to transform:

    @Select({"select * from MyTable"})
    @Results({@Result(column = "ID", property = "id", jdbcType = JdbcType.VARCHAR, id = true),
              @Result(column = "COL_1", property = "col1", jdbcType = JdbcType.VARCHAR),
              @Result(column = "COL_2", property = "col2", jdbcType = JdbcType.VARCHAR),
              @Result(column = "COL_3", property = "col3", jdbcType = JdbcType.VARCHAR)})
    MyTable selectAllFromMyTable();

After the transformation I get the following XML part:

        <select id="selectAllFromMyTable">
        select * from MyTable   
        </select>

What I miss is the corresponding <resultMap>...</resultMap>.

I see also in the code, that there is a TODO here: https://github.com/mybatis/mybatipse/blob/3a23a895e56e57dc5c78cb4d51983a7d7a8c9ebe/mybatipse/src/net/harawata/mybatipse/mybatis/JavaQuickAssistProcessor.java#L241

Is this feature planned any time soon?

Thank you in advance, Kiru

harawata commented 7 years ago

Hi @kiru ,

OK, I'll work on that next. It will be a new independent quick assist action, probably. Thanks for the feedback!

harawata commented 7 years ago

It should move @ConstructorArg to <constructor />, but it does not. I will fix it in the next version (see #69).