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

91 views
Skip to first unread message

刘同彬

unread,
Jul 19, 2019, 2:11:22 AM7/19/19
to mybatis-user
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.

Iwao AVE!

unread,
Jul 19, 2019, 8:12:00 AM7/19/19
to mybatis-user
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

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

刘同彬

unread,
Jul 22, 2019, 5:52:09 AM7/22/19
to mybatis-user
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 刘同彬 <lbea...@gmail.com> 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 mybati...@googlegroups.com.

Iwao AVE!

unread,
Jul 22, 2019, 7:38:44 AM7/22/19
to mybatis-user
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
Reply all
Reply to author
Forward
0 new messages