You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/08/28 06:08:55 UTC

[GitHub] [shardingsphere] vinceLin054 opened a new issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

vinceLin054 opened a new issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118


   Insert sql value using ognl ${@com.alibaba.fastjson.JSON@toJSONString(address)}
   
   The error message:
   `Caused by: java.lang.ClassCastException: org.apache.shardingsphere.sql.parser.sql.segment.dml.column.ColumnSegment cannot be cast to org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.ExpressionSegment
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitAssignmentValues(MySQLDMLVisitor.java:234)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitAssignmentValues(MySQLDMLVisitor.java:127)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$AssignmentValuesContext.accept(MySQLStatementParser.java:1865)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.createInsertValuesSegments(MySQLDMLVisitor.java:191)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitInsertValuesClause(MySQLDMLVisitor.java:184)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitInsertValuesClause(MySQLDMLVisitor.java:127)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$InsertValuesClauseContext.accept(MySQLStatementParser.java:1259)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitInsert(MySQLDMLVisitor.java:144)
   	at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitInsert(MySQLDMLVisitor.java:127)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$InsertContext.accept(MySQLStatementParser.java:1090)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse0(SQLParserEngine.java:80)
   	at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse(SQLParserEngine.java:61)`
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] vinceLin054 closed issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

Posted by GitBox <gi...@apache.org>.
vinceLin054 closed issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking commented on issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118#issuecomment-684486418


   ```
   INSERT INTO
   uc_users
   (username, connection_id, email, phone_number, address)
   VALUES
   (1, 1, '1111',1111, '{"province":"230","city":"75"}')
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] vinceLin054 commented on issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

Posted by GitBox <gi...@apache.org>.
vinceLin054 commented on issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118#issuecomment-683539743


   I think ${} cause this exception.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] vinceLin054 commented on issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

Posted by GitBox <gi...@apache.org>.
vinceLin054 commented on issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118#issuecomment-683239661


   Original sql:
   `INSERT INTO
    uc_users
   (username, connection_id, email, phone_number, address)
    VALUES
   (#{username}, #{connectionId}, #{email},#{phoneNumber}, ${@com.alibaba.fastjson.JSON@toJSONString(address)address})
   
   This exception happened before actual sql generate.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking commented on issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118#issuecomment-682377408


   plz show your original sql and actual sql


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking edited a comment on issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118#issuecomment-684486418


   You can try
   ```
   INSERT INTO
   uc_users
   (username, connection_id, email, phone_number, address)
   VALUES
   (1, 1, '1111',1111, '{"province":"230","city":"75"}')
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] vinceLin054 commented on issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

Posted by GitBox <gi...@apache.org>.
vinceLin054 commented on issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118#issuecomment-683369495


   ` ${@com.alibaba.fastjson.JSON@toJSONString(address)})`
   This is the hashMap type.
   ```
   Map<String,String> map = new HashMap();
   map.put("province", 230);
   map.put("city", 75);
   ```
   concrete value:
   {"province":"230","city":"75"}


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] vinceLin054 commented on issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

Posted by GitBox <gi...@apache.org>.
vinceLin054 commented on issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118#issuecomment-683534188


   This exception happened  again when I using string({"province":"230","city":"75"})  replace that ognl.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking commented on issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118#issuecomment-683265468


   > ${@com.alibaba.fastjson.JSON@toJSONString(address)address} 
   
   should be a concrete value before passed to shardingspehre.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] vinceLin054 commented on issue #7118: 4.1.1mapper.xml use ognl cause ClassCastException

Posted by GitBox <gi...@apache.org>.
vinceLin054 commented on issue #7118:
URL: https://github.com/apache/shardingsphere/issues/7118#issuecomment-685242987


   Yep, this way can make success.I hope you can be compatible with this situation.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org