openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Renaud (JIRA)" <j...@apache.org>
Subject [jira] Created: (OPENJPA-1721) duplicate key exception improperly rolled up / nesting is screwed up
Date Fri, 09 Jul 2010 01:00:52 GMT
duplicate key exception improperly rolled up / nesting is screwed up
--------------------------------------------------------------------

                 Key: OPENJPA-1721
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1721
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 2.0.0
            Reporter: Benjamin Renaud


When I create an entity (persist) with an primary key that already exists in the database,
I get two PersistenceExceptions, not just one. They are stacked up in the trace below.

Furthermore, when I intercept the exception in Spring in the debugger, that first PersistenceException
has itself nested in there.

Patrick Linskey saw this and asked me to file. It's a real bug :)

ERROR qtp65786118-30 root - Error id: 27366973-66f3-48ce-a012-faa14d24a918
org.springframework.orm.jpa.JpaSystemException: The transaction has been rolled back.  See
the nested exceptions for details on the errors that occurred.; nested exception is <openjpa-2.0.0-r422266:935683
fatal general error> org.apache.openjpa.persistence.PersistenceException: The transaction
has been rolled back.  See the nested exceptions for details on the errors that occurred.
FailedObject: com.taskdock.server.api.entity.task.TaskEntity@25457ca7
	at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:311)
	at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java:120)
	at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:471)
	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:374)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy78.createTask(Unknown Source)
	at com.taskdock.server.api.controller.SpaceController.createTask(SpaceController.java:207)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175)
	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421)
	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:774)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:527)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:423)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:493)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:930)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:358)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:866)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
	at org.eclipse.jetty.server.Server.handle(Server.java:337)
	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:595)
	at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1055)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:764)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:217)
	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:424)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:489)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
	at java.lang.Thread.run(Thread.java:637)
Caused by: <openjpa-2.0.0-r422266:935683 fatal general error> org.apache.openjpa.persistence.PersistenceException:
The transaction has been rolled back.  See the nested exceptions for details on the errors
that occurred.
FailedObject: com.taskdock.server.api.entity.task.TaskEntity@25457ca7
	at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2302)
	at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2139)
	at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2037)
	at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1955)
	at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
	at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1479)
	at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:925)
	at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:559)
	at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:467)
	... 43 more
Caused by: <openjpa-2.0.0-r422266:935683 fatal general error> org.apache.openjpa.persistence.PersistenceException:
ERROR: duplicate key value violates unique constraint "task_pkey" {prepstmnt 2099855393 INSERT
INTO api.task (id, completionType, creationDate, description, dueDate, lastUpdatedDate, summary,
version, SPACE_ID, CONTENT_ID, REQUESTER_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=(String)
27c34cae-831b-46ef-ac2e-00b0cf4fd304, (String) AnyoneCanComplete, (Timestamp) 2010-07-08 17:39:51.72,
(null) null, (null) null, (Timestamp) 2010-07-08 17:39:51.74, (String) Test task, (int) 1,
(String) 253ed6d9-22ae-4850-9ca6-d92e4eb9c2a4, (null) null, (long) 4009]} [code=0, state=23505]
FailedObject: com.taskdock.server.api.entity.task.TaskEntity@25457ca7
	at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4821)
	at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4787)
	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136)
	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:78)
	at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushAndUpdate(PreparedStatementManagerImpl.java:143)
	at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushAndUpdate(BatchingPreparedStatementManagerImpl.java:81)
	at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:99)
	at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:87)
	at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:550)
	at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:106)
	at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingConstraintUpdateManager.java:59)
	at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:103)
	at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:76)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:751)
	at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:131)
	... 51 more
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: ERROR: duplicate key value violates
unique constraint "task_pkey" {prepstmnt 2099855393 INSERT INTO api.task (id, completionType,
creationDate, description, dueDate, lastUpdatedDate, summary, version, SPACE_ID, CONTENT_ID,
REQUESTER_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=(String) 27c34cae-831b-46ef-ac2e-00b0cf4fd304,
(String) AnyoneCanComplete, (Timestamp) 2010-07-08 17:39:51.72, (null) null, (null) null,
(Timestamp) 2010-07-08 17:39:51.74, (String) Test task, (int) 1, (String) 253ed6d9-22ae-4850-9ca6-d92e4eb9c2a4,
(null) null, (long) 4009]} [code=0, state=23505]
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:257)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:233)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$1000(LoggingConnectionDecorator.java:70)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:1079)
	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:285)
	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:285)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeUpdate(JDBCStoreManager.java:1722)
	at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.executeUpdate(PreparedStatementManagerImpl.java:267)
	at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushAndUpdate(PreparedStatementManagerImpl.java:118)
	... 61 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message