相关疑难解决方法(0)

如何将包含单引号的字符串保存到PostgreSQL中的文本列

我使用hibernate和PostgreSQL作为Smartwcm Web应用程序SDK中的数据库.我在其中一个表中有一个字段,其数据类型是文本.当我尝试使用相应的POJO使用hibernate将值插入表中时,如果我尝试保存到数据库中的String包含,则抛出异常 '.

异常消息是:

Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; SQL [update public.slider_group set slid_grou_title=?, slid_grou_short_desc=?, site_id=?, status=?, update_date=?, no_slide=?, pos_type=?, widget_type=?, custom_html=?, widget_url=? where slid_grou_id=?]; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
Run Code Online (Sandbox Code Playgroud)

我对应表的java对象是:

 public class WidgetContentTo
        {
            private int             widgetContentId;
            private int     siteId;
            private String      widgetContentName;
            private String      widgetContentShortDesc;
            private int             noWebcontents;
            private String      status;
            private Timestamp   timeCreated;
            private Timestamp   updateDate;
            private String      posType;
            private String      widgetType;
            private …
Run Code Online (Sandbox Code Playgroud)

java sql postgresql orm hibernate

8
推荐指数
1
解决办法
814
查看次数

标签 统计

hibernate ×1

java ×1

orm ×1

postgresql ×1

sql ×1