Today I encountered a problem that when INSERT is not a problem, there is no problem inserting a log, but it is not a problem, but I can’t insert it (I have a busy morning, my time is abominable)
Report the error as shown in the figure:
SqlSession [[email protected]] was not registered for synchronization because synchronization is not active
JDBC Connection [[email protected] wrapping [email protected]] will not be managed by Spring
==> Preparing: INSERT INTO order ( pk_id, order_price, product_id ) VALUES ( ?, ?, ? )
==> Parameters: 1(String), 50(Integer), 1501002853813071874(String)
Closing non transactional SqlSession [[email protected]]
org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: java.sql.SQLSyntaxErrorException: 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 ( pk_id,
order_price,
product_id ) VALUES ( '1',
50,
'15010028538130718' at line 1
### The error may exist in com/zhang/mapper/OrderMapper.java (best guess)
### The error may involve com.zhang.mapper.OrderMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO order ( pk_id, order_price, product_id ) VALUES ( ?, ?, ? )
### Cause: java.sql.SQLSyntaxErrorException: 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 ( pk_id,
order_price,
product_id ) VALUES ( '1',
50,
'15010028538130718' at line 1
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: 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 ( pk_id,
order_price,
product_id ) VALUES ( '1',
50,
'15010028538130718' at line 1
and then follow the point in
Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to
Left think about right and think about it
I changed the table name to Order-> Pro_order.Order is the keywords of mysql splicing SQL statement.)