SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@174339a3] was not registered for synchronization because synchronization is not active
optimize this sql to a count sql has exception, sql:"SELECT @i:= @i+ 1 sequenceNum,
a.id newsId,
a.news_content newContent,
a.com_name shortComName
FROM alert_info_test a,
(SELECT @i:= (? - 1) * ?) r
WHERE a.index_id IN
(
?
)
AND a.dlr_nm = ?
AND a.news_status = ?
ORDER BY a.create_time DESC", exception:
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: ":" ":"
at line 1, column 10.Was expecting one of:
"&"
","
"."
"::"
";"
"<<"
">>"
"ACTION"
"ANY"
"AS"
"BYTE"
"CASCADE"
"CAST"
"CHANGE"
"CHAR"
"CHARACTER"
"COLLATE"
"COLUMN"
"COLUMNS"
"COMMENT"
"COMMIT"
"CONNECT"
"CYCLE"
"DESCRIBE"
"DISABLE"
"DO"
"DUPLICATE"
"ENABLE"
"END"
"EXCEPT"
"EXTRACT"
"FALSE"
"FIRST"
"FN"
"FOLLOWING"
"FOR"
"FROM"
"GROUP"
"HAVING"
"INDEX"
"INSERT"
"INTERSECT"
"INTERVAL"
"INTO"
"ISNULL"
"KEY"
"LAST"
"MATERIALIZED"
"MINUS"
"NEXTVAL"
"NO"
"NOLOCK"
"NULLS"
"OPEN"
"ORDER"
"OVER"
"PARTITION"
"PATH"
"PERCENT"
"PRECISION"
"PRIMARY"
"PRIOR"
"RANGE"
"READ"
"REPLACE"
"ROW"
"ROWS"
"SCHEMA"
"SEPARATOR"
"SESSION"
"SIBLINGS"
"SIZE"
"START"
"TABLE"
"TEMP"
"TEMPORARY"
"TOP"
"TRUE"
"TRUNCATE"
"TYPE"
"UNION"
"UNSIGNED"
"VALIDATE"
"VALUE"
"VALUES"
"VIEW"
"WHERE"
"WINDOW"
"XML"
"ZONE"
"["
"^"
"|"
<EOF>
<K_DATETIMELITERAL>
<K_DATE_LITERAL>
<S_CHAR_LITERAL>
<S_IDENTIFIER>
<S_QUOTED_IDENTIFIER>
解决方法
1.缺少sql解析工具的jar包
2.引入jsqlparser依赖包
<dependency> <groupId>com.github.jsqlparser</groupId> <artifactId>jsqlparser</artifactId> <version>4.1</version> </dependency>