org.springframework.dao.DataIntegrityViolationException
在采用getHibernateTemplate().save的时候,不能执行成功,后台报错
org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:622)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:378)
at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:639)
at com.firsttech.ai.dao.common.impl.LogInOutDAOImpl.saveTicket(LogInOutDAOImpl.java:114)
Truncated. see log file for complete stacktrace
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
Truncated. see log file for complete stacktrace
java.sql.BatchUpdateException: ORA-01400: 无法将 NULL 插入 ("AIS"."T_SYS_TICKET"."LOGIN_ID")
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10698)
at weblogic.jdbc.wrapper.PreparedStatement.executeBatch(PreparedStatement.java:157)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
Truncated. see log file for complete stacktrace
>
<2012-5-29 下午02时41分47秒 GMT+08:00> <Error> <HTTP> <BEA-101083> <Connection failure.
java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '5669' bytes instead of stated: '5659' bytes.
at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:410)
at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1293)
at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1335)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1375)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
Truncated. see log file for complete stacktrace
代码大概是:
public LogInOutDAOImpl(@Qualifier("AisSessionFactory") SessionFactory factory) {
super.setSessionFactory(factory);
}
Ticket ticket = new Ticket();
ticket.setId(ticketId);
ticket.setLoginID(userName);
getHibernateTemplate().save(ticket);
其中Ticket 是对应的javabean
一直都能正常执行,今天新搭了个环境就出错了,同样的代码在其他环境没问题