The sql in the mapper.xml file changed when it was executed.

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

The sql in the mapper.xml file changed when it was executed.

yongle lv
The sql in the mapper.xml file changed when it was executed.


mapper.xml:

select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark 
from sys_dict_data
where status = '0' and dict_type = #{dictType} order by dict_sort asc

log:

87a5c914a63e9c2400277c12badeef3.jpg






--
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/3c1f770b-a047-4e9c-8279-0dc155eb59e9%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: The sql in the mapper.xml file changed when it was executed.

Guy Rouillier-2
Well, you know what they say about "never say never", but this is a pretty fundamental flaw, and seems like it would have come up before now given how widely used MyBatis is.  For those who can't see the itsy-bitsy type in the included image, here is what it says:

### The error occurred while setting parameters
### SQL: SELECT dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark FROM sys_dict_data
WHERE status = '0' AND dict_type = ? order by detail_id desc LIMIT ?
### Cause: java.sql.SQLSyntaxErrorException: Unknown column 'detail_id' in 'order clause

Notice that in addition to the order by clause changing from "dict_sort asc" to "detail_id desc", other changes appear in the SQL.  Keywords SELECT, FROM, WHERE and AND have been capitalized, but not "order by". And the order by clause also has a LIMIT added.  The logging function in MyBatis does not change capitalization when logging SQL statements.

I'm suspicious that the SQL file being used is not the same as the one you are looking at.  Either a different version ended up in the netcat-system-0.0.1-SNAPSHOT.jar, or the SQL is being picked up from another location.  Start by unzipping the deployed JAR file and inspecting the included SysDictDataMapper.xml file, and also look for another copy of this file somewhere in that deployment.

--
Guy Rouillier

On 5/8/2020 5:49:41 AM, "yongle lv" <[hidden email]> wrote:

The sql in the mapper.xml file changed when it was executed.


mapper.xml:

select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark 
from sys_dict_data
where status = '0' and dict_type = #{dictType} order by dict_sort asc

log:

87a5c914a63e9c2400277c12badeef3.jpg






--
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/3c1f770b-a047-4e9c-8279-0dc155eb59e9%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/emed07a9bf-1759-48ec-80ed-53fa61667de0%40asus.