Error reporting details:
error querying database. Cause: com.baomidou.mybatisplus.core.exceptions.mybatisplus exception: failed to process, please exclude the tablename or statementid. Error SQL: XXXXXXXX
Error reason:
the user-defined SQL is used, which may contain special functions or complex syntax, so it is not supported by jsqlparser
(the fields such as tenant ID
cannot be added), so the jsqlparserexception
is thrown.
The exception is caught by mybatisplus and is encapsulated as mybatisplus exception
and then thrown.
Source code: com.baomidou.mybatisplus.core.parser.abstractjsqlparser
solution:
failed to process, please exclude the tablename or statementid
translation is: processing failed, please exclude the table name or statement ID
the P.S. prompt is very specific, but it’s easy to be confused, because the unfamiliar people don’t know that the tenant ID has a problem
Method 1: exclude the table name
when configuring tenanthandler
of mybatisplus, filter out the table in dotablefilter
method (that is, do not process the tenant ID
field of the table).
Method 2: exclude the statement
mark @ sqlparser (filter = true)
on the interface of custom SQL
@SqlParser(filter = true)
@Select("SQL")
void selectDemo();
The official explanation for this note is:
Tenant annotation supports method and mapper interface. The default value is false
true means to filter SQL parsing, that is, it will not enter the isqlparser parsing chain
if it is false, it will enter the parsing chain and append a tenant_ ID and so on.
Similar Posts:
- This Row already belongs to another table error when trying to add rows?
- [Solved] return null from a method with a primitive return type (int).
- Cannot change the executortype when there is an existing transaction [How to Solve]
- Failed to decode downloaded font [How to Solve]
- DB2 Errors and How to Solve them
- com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
- [Solved] Browser Error: Failed to decode downloaded font and OTS parsing error: Failed to convert *** font to ***
- [Solved] The bean ‘sysDictService’ could not be injected because it is a JDK dynamic proxy
- [Solved] module ‘keras.engine.topology’ has no attribute ‘load_weights_from_hdf5_group_by_name…