mysql 错误,springframework.jdbc.BadSqlGrammarException:我收到错误消息,找不到原因
mysql error, springframework.jdbc.BadSqlGrammarException: I got the error msg, couldn't find why
我收到了错误。
org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (productId, address, productName, price, imageUrl) VALUES ('000', 'address' at line 1
### The error may involve Order.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO order (productId, address, productName, price, imageUrl) VALUES (?, ?, ?, ?, ?)
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (productId, address, productName, price, imageUrl) VALUES ('000', 'address' at line 1
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (productId, address, productName, price, imageUrl) VALUES ('000', 'address' at line 1
at
我查看了我的 xml,正如错误日志告诉我的那样。
<insert id="insert" parameterType="com.whiuni.fastshop.vo.OrderVO">
INSERT INTO order (productId, address, productName, price, imageUrl) VALUES (#{productId}, #{address}, #{productName}, #{price}, #{imageUrl})
</insert>
谁能告诉我错误是什么?谢谢
order
是mysql中的保留字,更改table名称或用单引号括起来
INSERT INTO 'order' (productId, address, productName, price, imageUrl) ...
我收到了错误。
org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (productId, address, productName, price, imageUrl) VALUES ('000', 'address' at line 1
### The error may involve Order.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO order (productId, address, productName, price, imageUrl) VALUES (?, ?, ?, ?, ?)
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (productId, address, productName, price, imageUrl) VALUES ('000', 'address' at line 1
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (productId, address, productName, price, imageUrl) VALUES ('000', 'address' at line 1
at
我查看了我的 xml,正如错误日志告诉我的那样。
<insert id="insert" parameterType="com.whiuni.fastshop.vo.OrderVO">
INSERT INTO order (productId, address, productName, price, imageUrl) VALUES (#{productId}, #{address}, #{productName}, #{price}, #{imageUrl})
</insert>
谁能告诉我错误是什么?谢谢
order
是mysql中的保留字,更改table名称或用单引号括起来
INSERT INTO 'order' (productId, address, productName, price, imageUrl) ...