解决 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
顶
踩
相关文章:
- 解决 Cause: org.postgresql.util.PSQLException: ERR
- mybatis postgresql insert 添加数据返回主键值
- 解决 org.postgresql.util.PSQLException: 错误: INSE
- postgresql 创建序列方法_postgresql create sequence
- PostgreSQL 替换字符串方法及字符串操作函数
- postgresql 日期计算,时间加减 方法
- Navicat for PostgreSQL 10 好用的注册码
- postgresql windows下修改帐号密码 (图文)
- postgresql 数据类型转换,日期操作函数
- postgresql 字符串转整数 int、integer