数据库添加数据是报错 以下是控制台部分提示 我数据库字段没有2进制的 是字段类型错了吗
Hibernate:insertintoK_HOUSE(K_PRODUCE_NAME,K_PRODUCE_TYPE,K_PRODUCE_NUMBER,K_PRODUCE_...
Hibernate: insert into K_HOUSE (K_PRODUCE_NAME, K_PRODUCE_TYPE, K_PRODUCE_NUMBER, K_PRODUCE_PRICE, K_PRODUCE_BAD_NUMBER, K_PRODUCE_BAD_TYPE, K_HOUSE_ID) values (?, ?, ?, ?, ?, ?, ?)
2011-05-09 14:43:58,536 WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 0, SQLState: 22001>
2011-05-09 14:43:58,536 ERROR [org.hibernate.util.JDBCExceptionReporter] - <Data truncation>
2011-05-09 14:43:58,536 WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 8152, SQLState: 22001>
2011-05-09 14:43:58,536 ERROR [org.hibernate.util.JDBCExceptionReporter] - <将截断字符串或二进制数据。>
2011-05-09 14:43:58,536 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] - <Could not synchronize database state with session>
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
public void addObject(Object obj) throws Exception {
try {
getHibernateTemplate().save(obj);
dao里的这行报错 getHibernateTemplate().flush();
} catch (Exception e) {
e.printStackTrace();
throw new Exception("向数据库表中添加记录错误.");
}
} 展开
2011-05-09 14:43:58,536 WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 0, SQLState: 22001>
2011-05-09 14:43:58,536 ERROR [org.hibernate.util.JDBCExceptionReporter] - <Data truncation>
2011-05-09 14:43:58,536 WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 8152, SQLState: 22001>
2011-05-09 14:43:58,536 ERROR [org.hibernate.util.JDBCExceptionReporter] - <将截断字符串或二进制数据。>
2011-05-09 14:43:58,536 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] - <Could not synchronize database state with session>
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
public void addObject(Object obj) throws Exception {
try {
getHibernateTemplate().save(obj);
dao里的这行报错 getHibernateTemplate().flush();
} catch (Exception e) {
e.printStackTrace();
throw new Exception("向数据库表中添加记录错误.");
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询