selectProvider

3 views
Skip to first unread message

charleymor...@gmail.com

unread,
Nov 29, 2018, 3:15:40 AM11/29/18
to mybatis-user
What is the difference between #{} in selectprovider and #{} in xml?

Guy Rouillier

unread,
Nov 29, 2018, 3:26:26 AM11/29/18
to mybati...@googlegroups.com
They mean the same thing, they are parameter placeholders.  The SelectProvider simply supplies the SQL SELECT statement that you would otherwise type by hand in the XML file.  The rest of the MyBatis framework remains the same.

--
Guy Rouillier


莫昌廉

unread,
Nov 29, 2018, 3:35:18 AM11/29/18
to mybati...@googlegroups.com
image.pngI want to pass item to #{} and get the item's Member variables,but it's Incorrect,right?

Guy Rouillier <guy.ro...@gmail.com> 于2018年11月29日周四 下午4:26写道:
--
You received this message because you are subscribed to a topic in the Google Groups "mybatis-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mybatis-user/6RPqsNQmu_A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mybatis-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Guy Rouillier

unread,
Nov 29, 2018, 3:53:14 AM11/29/18
to mybati...@googlegroups.com
I'm having trouble reading your inline images, even using an on-screen magnifier.  But the SQL does not appear to be correct.  The code has a FOR loop over attributes, and inside the loop is a SELECT statement.  That means if there are (for example) 3 elements in your attributes list, the FOR loop is going to generate 3 SELECT statements, separated by commas, which is invalid SQL.

--
Guy Rouillier
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.

莫昌廉

unread,
Nov 29, 2018, 4:01:53 AM11/29/18
to mybati...@googlegroups.com
sorry,I cut screen by computor,so I don't know you will have trouble. The  SELECT can be called multiple times, parameters will also be added to the SELECT clause.

Guy Rouillier <guy.ro...@gmail.com> 于2018年11月29日周四 下午4:53写道:
image.png
Reply all
Reply to author
Forward
0 new messages