日期:2014-05-19  浏览次数:20640 次

[80分]求 Hibernate postgresql数据库问题...
通过Hibernate执行保存操作报错. 单独把SQL拧出来执行又可以插入成功, 求大神们解决下..

错误信息如下:
----------------------------------
Cause by: java.sql.BatchUpdateException: 批次处理 0 insert into OSC_SYS_SERVER (IS_MASTER, SERVER_APP_DIR, SERVER_CODE, SERVER_DESC, SERVER_DST_DIR, SERVER_MAX_CPU_PERCENT, SERVER_MAX_DISK_PERCENT, SERVER_MAX_MEM_PERCENT, SERVER_NAME, NODE_ID, SERVER_PORT, SERVER_SCAN_INTERVAL, SERVER_SCRIPT_DIR, SERVER_SPLIT_DIR, SERVER_SRC_DIR, SERVER_STATE, SERVER_TEMP_DIR, SERVER_TIMEOUT, SERVER_TYPE_ID, SERVER_VERSION, SERVER_ID) values ('0', 'test', 'test', '', 'ste', '100', '100', '100', 'test', '104', '2342', '23', 'tse', 'NULL', 'testr', '1', 'ste', '32', '2', NULL, '2001') 被中止,呼叫 getNextException 以取得原因。
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2588)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1796)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2727)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:467)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)

------解决方案--------------------
我刚刚遇到同样的问题,解决了,我把配置文件里的字段跟数据库里的字段一个一个比较,发现是数据库里少了一个字段。。