解决 Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: column "type" is of

postgresql在使用spring添加数据的时候出现如下错误

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: column "type" is of type integer but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 218
### The error may involve net.suntec.dynabiz.resources.mybatis.MtMsgContentMapper.create-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO tb_msg(             id, title, body, type, name, owner_id, create_date, create_user_id,              update_date, update_user_id, delete_flg)      VALUES (nextval('seq_mt_msg_content_id'), ?, ?, ?, ?        ,?, now(), ?,now(), ?,'0')
### Cause: org.postgresql.util.PSQLException: ERROR: column "type" is of type integer but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 218
; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: column "type" is of type integer but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 218
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
    at org.springframework.test.web.servlet.TestDispatcherServlet.service(TestDispatcherServlet.java:66)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

查看错误信息column "type" is of type integer but expression is of type character varying

意思是字段“type” 是int整数型的字段,而出入的属性是character varying字符串类型

说明数据类型不匹配,需要修改属性的类型改成int类型,或者修改db数据库字段的类型

来源://作者:/更新时间:2014-02-24
相关文章

最新文章

新热推荐

文章排行