mybatis transfer a column with stop to a hashmap, nor a string

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

mybatis transfer a column with stop to a hashmap, nor a string

刘同彬
I seems that Mybatis would transfer a column with stop to a hashmap, nor a string. How can I convert it to a string?
eg: I have a column named aa.bb, the value in db is 10. I config the resultType is 'java.util.HashMap', mybatis return aa:{bb:10}, nor aa.bb:10. 
I read the source, the class PropertyTokenizer's constructor make it happened. How can I get the result: aa.bb:10.

--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/c171b93e-bb8c-48f0-9229-b393e7e29216%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: mybatis transfer a column with stop to a hashmap, nor a string

Iwao AVE!
Hi,

In MyBatis (and most expression languages), dot '.' is used to access properties.
As explained in the old ticket below, there is not much we can do.
I would suggest changing the column name if that's possible.

Regards,
Iwao

On Fri, Jul 19, 2019 at 3:11 PM 刘同彬 <[hidden email]> wrote:
I seems that Mybatis would transfer a column with stop to a hashmap, nor a string. How can I convert it to a string?
eg: I have a column named aa.bb, the value in db is 10. I config the resultType is 'java.util.HashMap', mybatis return aa:{bb:10}, nor aa.bb:10
I read the source, the class PropertyTokenizer's constructor make it happened. How can I get the result: aa.bb:10.

--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/c171b93e-bb8c-48f0-9229-b393e7e29216%40googlegroups.com.

--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CA%2Buep2StYMr%3DX1SiB2iuUjBjDQX9O3NBn4KeSnBoHReHga%3Diiw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: mybatis transfer a column with stop to a hashmap, nor a string

刘同彬
Hi,
I think in some situations, columns may contains dot '.', but developers don't need the hashmap, they just need the string. Could I make a pull request if possible?


在 2019年7月19日星期五 UTC+8下午8:12:00,Iwao AVE!写道:
Hi,

In MyBatis (and most expression languages), dot '.' is used to access properties.
As explained in the old ticket below, there is not much we can do.
<a href="https://github.com/mybatis/mybatis-3/issues/13" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmybatis%2Fmybatis-3%2Fissues%2F13\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHQNVxfzHWlTYoiG2m4e14dgG48Cw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmybatis%2Fmybatis-3%2Fissues%2F13\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHQNVxfzHWlTYoiG2m4e14dgG48Cw&#39;;return true;">https://github.com/mybatis/mybatis-3/issues/13
I would suggest changing the column name if that's possible.

Regards,
Iwao

On Fri, Jul 19, 2019 at 3:11 PM 刘同彬 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="0cHYGLVmDQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">lbea...@...> wrote:
I seems that Mybatis would transfer a column with stop to a hashmap, nor a string. How can I convert it to a string?
eg: I have a column named <a href="http://aa.bb" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Faa.bb\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEuCW07L4BLR9makzJk7h2Cb6de_g&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Faa.bb\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEuCW07L4BLR9makzJk7h2Cb6de_g&#39;;return true;">aa.bb, the value in db is 10. I config the resultType is 'java.util.HashMap', mybatis return aa:{bb:10}, nor <a href="http://aa.bb:10" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Faa.bb%3A10\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGK5WnDOw6PYCwM1zDcsrf-g1HrcQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Faa.bb%3A10\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGK5WnDOw6PYCwM1zDcsrf-g1HrcQ&#39;;return true;">aa.bb:10. 
I read the source, the class PropertyTokenizer's constructor make it happened. How can I get the result: <a href="http://aa.bb:10" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Faa.bb%3A10\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGK5WnDOw6PYCwM1zDcsrf-g1HrcQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Faa.bb%3A10\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGK5WnDOw6PYCwM1zDcsrf-g1HrcQ&#39;;return true;">aa.bb:10.

--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="0cHYGLVmDQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybati...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/mybatis-user/c171b93e-bb8c-48f0-9229-b393e7e29216%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/mybatis-user/c171b93e-bb8c-48f0-9229-b393e7e29216%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/mybatis-user/c171b93e-bb8c-48f0-9229-b393e7e29216%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/mybatis-user/c171b93e-bb8c-48f0-9229-b393e7e29216%40googlegroups.com.

--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/cc815c57-eb65-453f-9d58-da3315a58656%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: mybatis transfer a column with stop to a hashmap, nor a string

Iwao AVE!
Hi,

It may not be possible because OGNL does not support it (AFAIK).
And even if it is possible, every user is affected by the change (performance, code complication, etc.).
So, I'm sorry, but I don't think it is worth it.

For the sake of future-you, let me share what experts say.

Regards,
Iwao

On Mon, Jul 22, 2019 at 18:52 刘同彬 <[hidden email]> wrote:
Hi,
I think in some situations, columns may contains dot '.', but developers don't need the hashmap, they just need the string. Could I make a pull request if possible?


在 2019年7月19日星期五 UTC+8下午8:12:00,Iwao AVE!写道:
Hi,

In MyBatis (and most expression languages), dot '.' is used to access properties.
As explained in the old ticket below, there is not much we can do.
I would suggest changing the column name if that's possible.

Regards,
Iwao

On Fri, Jul 19, 2019 at 3:11 PM 刘同彬 <[hidden email]> wrote:
I seems that Mybatis would transfer a column with stop to a hashmap, nor a string. How can I convert it to a string?
eg: I have a column named aa.bb, the value in db is 10. I config the resultType is 'java.util.HashMap', mybatis return aa:{bb:10}, nor aa.bb:10
I read the source, the class PropertyTokenizer's constructor make it happened. How can I get the result: aa.bb:10.


--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CA%2Buep2SsiMGaE7HTj1ZQzMEjdsAz2FN_7eRC9Tt4fL98WUO2FA%40mail.gmail.com.