I find a interesting phenomenon in mybatis

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

I find a interesting phenomenon in mybatis

Jing Lee
I used resultType in xml diffrent with mapper interface like this


List<UserInfo> getAllUser();


<select id="getAllUser" resultType="com.eumji.date.model.UserResponse">
    select
* from user_info
</select>


The class UserInfo is diffrent with class UserResponse

but it can be used like this







 














I read the Source code, Find when we want return list type infos,we most  refer to the resultType in xml .

  
so I suggest  it can match xml resultType and the list type.


I find,in MethodSignature's constructor,resolvedReturnType contain the type we need

Mybatis We can use it to solve this problem

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: I find a interesting phenomenon in mybatis

Björn Raupach
Hello Jing Lee,

could you elaborate on your problem? What did you expect? What happened? Are you talking about a bug or a feature?

kind regards,
Björn

On 13. Mar 2018, at 12:58, Jing Lee <[hidden email]> wrote:

I used resultType in xml diffrent with mapper interface like this


List<UserInfo> getAllUser();


<select id="getAllUser" resultType="com.eumji.date.model.UserResponse">
    select
* from user_info
</select>


The class UserInfo is diffrent with class UserResponse

but it can be used like this







 














I read the Source code, Find when we want return list type infos,we most  refer to the resultType in xml .

  
so I suggest  it can match xml resultType and the list type.


I find,in MethodSignature's constructor,resolvedReturnType contain the type we need

Mybatis We can use it to solve this problem


--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: I find a interesting phenomenon in mybatis

Jing Lee
What I want to elaborate is that when the two return types are different(like xml resultType is UserResponse, mapper interface is List<UserInfo>), the friendly prompt types should be inconsistent. 
but now the list<UserInfo> can apply restType is UserResponse's select statement。

so maybe it's a bug

kind regards,
eumji

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.