org.hibernate.exception.ConstraintViolationException


org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:91)at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:86)at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:171)at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2048)at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2427)at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:980)at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:353)at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)at struts.dao.project.budgetAnalysis.BudgetPlanningDAO.saveNewBudget(BudgetAnalysisDAO.java:428)at struts.project.budgetAnalysis.NewBudgetPlanSaveAction.execute(NewBudgetSaveAction.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("ROOT"."PROJECT_BUDGET_TEST"."APPROVED_STATUS")

at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:8739)
at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
... 36 more

Solution:

This type of problems generally occurs when we try to violate the constraint relationship of the tables.
The fallowing cases may be the reason for the above exception:
1)If the user try to enter null value into not null fields of the database.
2)If the user trying to store other format value into the database field.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.