数据库显示乱码,求老师帮忙

来源:5-4 添加事务管理-Spring整合Hibernate

qq_敢心包_03378049

2016-10-24 11:15

580d7c520001b68005000314.jpg

580d7c530001e0e705000135.jpg

数据库编码utf8了,jsp的也设置utf-8,但是就是一直报下面这个错

ERROR - Data truncation: Data too long for column 'pname' at row 1

ERROR - Exception occurred during processing request: could not insert: [cn.test.ssh.domain.Product]; SQL [insert into product (pname, price) values (?, ?)]; nested exception is org.hibernate.exception.DataException: could not insert: [cn.test.ssh.domain.Product]

org.springframework.dao.DataIntegrityViolationException: could not insert: [cn.test.ssh.domain.Product]; SQL [insert into product (pname, price) values (?, ?)]; nested exception is org.hibernate.exception.DataException: could not insert: [cn.test.ssh.domain.Product]

at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:648)

at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)

at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:412)

at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:375)

at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:684)

at cn.test.ssh.dao.ProductDao.save(ProductDao.java:16)


写回答 关注

0回答

还没有人回答问题,可以看看其他问题

基于SSH实现员工管理系统之框架整合篇

本视频教程主要介绍环境搭建和SSH框架整合,逐层深入理解学习

49831 学习 · 344 问题

查看课程

相似问题