Home  >  Article  >  Database  >  mybatis-MyBatis如何保存带有双引号的字符串

mybatis-MyBatis如何保存带有双引号的字符串

WBOY
WBOYOriginal
2016-06-06 09:39:063055browse

mybatismysqljavasql

今天用MyBatis保存数据的时候突然发现报错了!
org.apache.ibatis.exceptions.PersistenceException:

Error updating database. Cause: java.sql.SQLException: Syntax error or access violation message from server: "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 'desc,link,pubDate,source,title,channelId,imageurls)

    values    ('杭州西湖湖' at line 2"

The error may involve /.addNews-Inline

The error occurred while setting parameters

SQL: insert into News (desc,link,pubDate,source,title,channelId,imageurls) values (?,?,?,?,?,?,?)

初步估计应该是因为保存的字符串有双引号的关系!求大神致电如何解决这种问题 keyProperty="id" useGeneratedKeys="true">
insert into News
(desc,link,pubDate,source,title,channelId,imageurls)
values
(#{desc},#{link},#{pubDate},#{source},#{title},#{channelId},#{imageurls})

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn