Java's database table fields have key error java.sql.SQLSyntaxErrorException

Two days before encountered in the development of a pit, I had the pleasure of doing CRUD, then the tragedy happened during query the database, reported java.sql.SQLSyntaxErrorException:

After investigation, because of the presence keyword database table field:

Here the focus here, I use mybatis-plus, my solution is as follows:

Increase in this field @TableField (value = "` key` ") can be annotated with` `wrap the field, is a number in front of the half-width English state that symbol.

Then no problem running it

 

one more thing:

1. If you are using jpa, you can add annotations @Column on the field (name = "` key` ") can be.

2. The above method is in the case can not modify the database field, if you can modify the field, modify the field name.

 

More than the desire to help everyone.

Guess you like

Origin www.cnblogs.com/ailanlan/p/12034443.html