Quantcast

Result vs Collections

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Result vs Collections

alex
Hi, 
Mybatis version 3.4.2 Java 8 ?

I have, probably strange, question about mappings
Let's assume that we had Party entity with a single participant (yeah, that should be pretty boring). We map it like this. 

<result column="participant" property="participants_name" jdbcType="VARCHAR"/>

First that come to me by surprise  is that if I use the whole resultMap in selections, the field absence does not raise an exception.  
Next, let's change it to

<collection property="participants" jdbcType="VARCHAR" ofType="string" javaType="list">
<result column="participants_name" />
</collection>

Now selection fails if there is no participants_name  column in field set. Is that by design? I cannot find appropriate statement in documentation. 
I feel like I miss something here and can't understand what exactly it is. 
Thank you.

--
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
|  
Report Content as Inappropriate

Re: Result vs Collections

Iwao AVE!
Hi,

It's a little bit unclear what your problem is.
Please create a test case [1] or a demo app [2] that demonstrates your issue and upload it to a GitHub repo.


Regards,
Iwao

2017-03-05 0:36 GMT+09:00 <[hidden email]>:
Hi, 
Mybatis version 3.4.2 Java 8 ?

I have, probably strange, question about mappings
Let's assume that we had Party entity with a single participant (yeah, that should be pretty boring). We map it like this. 

<result column="participant" property="participants_name" jdbcType="VARCHAR"/>

First that come to me by surprise  is that if I use the whole resultMap in selections, the field absence does not raise an exception.  
Next, let's change it to

<collection property="participants" jdbcType="VARCHAR" ofType="string" javaType="list">
<result column="participants_name" />
</collection>

Now selection fails if there is no participants_name  column in field set. Is that by design? I cannot find appropriate statement in documentation. 
I feel like I miss something here and can't understand what exactly it is. 
Thank you.

--
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.
Loading...