]
Peter Rader commented on HHH-6665:
----------------------------------
Please delete this issue!
Was my fault, i created the audited Table with colum "REV" as Primary Key!
Enver EJB3 throws CVE on multiple insert into same Table_AUD.
-------------------------------------------------------------
Key: HHH-6665
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6665
Project: Hibernate Core
Issue Type: Bug
Environment: Enver 3.6.7F, Hibernate 3.6.6F
Reporter: Peter Rader
Priority: Blocker
Labels: auditing, hibernate, jpa2
Original Estimate: 40h
Remaining Estimate: 40h
It is not possible to save multiple entitys.
Code i am using:
public class Messages implements MessagesRemote {
@PersistenceContext(unitName = "jpa")
Session hibernateSession;
public void antwortAbsenden(Nachricht currentMessage) {
log.info("Versende Nachricht von '"+
currentMessage.getSender().getEmail() + "' ...");
List<NachrichtEmpfaenger> empfaenger = currentMessage.getEmpfaenger();
if (empfaenger.size() == 0) throw new IllegalArgumentException("Es muss
mindestens ein Empfänger angegeben werden.");
Transaction t1 = hibernateSession.beginTransaction();
hibernateSession.persist(currentMessage);
for (NachrichtEmpfaenger empfaengerPerson : empfaenger) {
empfaengerPerson.setNachricht(currentMessage);
NachrichtEmpfaenger e = new NachrichtEmpfaenger();
e.setNachricht(currentMessage);
Benutzer benutzer = empfaengerPerson.getBenutzer();
log.info("Fuege "+benutzer.getBenutzer()+" Hinzu");
e.setBenutzer(benutzer);
hibernateSession.saveOrUpdate(e);
}
t1.commit();
hibernateSession.flush();
log.info("Nachricht erfolgreich versendet!");
}
prints:
18:04:33,371 INFO [Messages] Versende Nachricht von 'p.rader@xxxxx' ...
18:04:33,371 INFO [Messages] Fuege 1 Hinzu
18:04:33,387 INFO [Messages] Fuege 2 Hinzu
18:04:33,387 INFO [Messages] Nachricht erfolgreich versendet!
18:04:33,402 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState:
23505
18:04:33,402 ERROR [org.hibernate.util.JDBCExceptionReporter] Batch-Eintrag 1 insert into
nachricht_empfaenger_AUD (REVTYPE, gelesen, empfaenger, nachricht_id,
nachricht_empfaenger_id, REV) values ('0
', '0', '2', '83', '123', '180') wurde
abgebrochen. Rufen Sie 'getNextException' auf, um die Ursache zu erfahren.
18:04:33,402 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState:
23505
18:04:33,402 ERROR [org.hibernate.util.JDBCExceptionReporter] ERROR: duplicate key value
violates unique constraint "nachricht_empfaenger_aud_pkey"
18:04:33,418 WARN [com.arjuna.ats.arjuna] ARJUNA-12125
TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple<
0:ffffc0a8013c:126a:4e74bf62:12f, org.hibernate.transaction.synchronizat
ion.HibernateSynchronizationImpl@73b0a5b >:
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
[:3.6.6.Final]
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
[:3.6.6.Final]
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
[:3.6.6.Final]
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)
[:3.6.6.Final]
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
[:3.6.6.Final]
at
org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)
[:3.6.6.Final]
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2411)
[:3.6.6.Final]
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2874)
[:3.6.6.Final]
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
[:3.6.6.Final]
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273) [:3.6.6.Final]
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
[:3.6.6.Final]
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
[:3.6.6.Final]
at
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
[:3.6.6.Final]
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
[:3.6.6.Final]
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216) [:3.6.6.Final]
at
org.hibernate.envers.synchronization.AuditProcess.doBeforeTransactionCompletion(AuditProcess.java:155)
[:3.6.7.Final]
at
org.hibernate.engine.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:543)
[:3.6.6.Final]
at
org.hibernate.engine.ActionQueue.beforeTransactionCompletion(ActionQueue.java:216)
[:3.6.6.Final]
at
org.hibernate.impl.SessionImpl.beforeTransactionCompletion(SessionImpl.java:571)
[:3.6.6.Final]
at
org.hibernate.jdbc.JDBCContext.beforeTransactionCompletion(JDBCContext.java:250)
[:3.6.6.Final]
at
org.hibernate.transaction.synchronization.CallbackCoordinator.beforeCompletion(CallbackCoordinator.java:125)
[:3.6.6.Final]
at
org.hibernate.transaction.synchronization.HibernateSynchronizationImpl.beforeCompletion(HibernateSynchronizationImpl.java:51)
[:3.6.6.Final]
at
com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:97)
[:6.1.0.Final]
at
com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:274)
[:6.1.0.Final]
at
com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:94)
[:6.1.0.Final]
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:159)
[:6.1.0.Final]
at
com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1158)
[:6.1.0.Final]
at
com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:119)
[:6.1.0.Final]
at
com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
[:6.1.0.Final]
at
org.jboss.ejb3.tx2.impl.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:82)
[:0.0.2]
at
org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:255)
[:0.0.2]
at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:349)
[:0.0.2]
at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:209)
[:0.0.2]
at
org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52)
[:0.0.2]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
[:1.0.0.GA]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.4]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at
org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:182)
[:1.7.21]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
[:1.7.21]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at
org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
[:1.7.21]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at
org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47)
[:1.7.21]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at
org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
[:1.0.1]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at
org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)
[:1.7.21]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at
org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:392)
[:1.7.21]
at
org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:88)
[:1.7.21]
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:75)
[:1.7.21]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at
org.jboss.ejb3.async.impl.interceptor.AsynchronousClientInterceptor.invoke(AsynchronousClientInterceptor.java:143)
[:1.7.21]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[jboss-aop.jar:2.2.2.GA]
at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62) [:1.0.1.GA]
at $Proxy163.invoke(Unknown Source) at
org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185)
[:1.0.11]
at $Proxy165.antwortAbsenden(Unknown Source) at
de.XXXXX.managedbeans.forum.MessagesMB.antwortSenden(MessagesMB.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[:1.6.0_25]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_25]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_25]
at org.apache.el.parser.AstValue.invoke(AstValue.java:196) [:6.1.0.Final]
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
[:6.1.0.Final]
at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
at
javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:144)
[:2.0.3-]
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:84) [:2.0.3-]
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:773)
[:2.0.3-]
at javax.faces.component.UICommand.broadcast(UICommand.java:296) [:2.0.3-]
at
org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:168)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
at
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
[:2.0.3-]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) [:2.0.3-]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
[:2.0.3-]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308) [:2.0.3-]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324)
[:6.1.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
[:6.1.0.Final]
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274)
[:6.1.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
[:6.1.0.Final]
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[:6.1.0.Final]
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[:6.1.0.Final]
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181)
[:6.1.0.Final]
at
org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285)
[:1.1.0.Final]
at
org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261)
[:1.1.0.Final]
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88)
[:6.1.0.Final]
at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100)
[:6.1.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:159)
[:6.1.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[:6.1.0.Final]
at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
[:6.1.0.Final]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[:6.1.0.Final]
at
org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)
[:6.1.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
[:6.1.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[:6.1.0.Final]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)
[:6.1.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
[:6.1.0.Final]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_25]
Caused by: java.sql.BatchUpdateException: Batch-Eintrag 1 insert into
nachricht_empfaenger_AUD (REVTYPE, gelesen, empfaenger, nachricht_id,
nachricht_empfaenger_id, REV) values ('0', '0', '2', '83',
'
123', '180') wurde abgebrochen. Rufen Sie 'getNextException' auf, um
die Ursache zu erfahren.
at
org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2569)
[:]
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:2708)
[:]
at
org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:774)
[:6.1.0.Final]
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
[:3.6.6.Final]
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
[:3.6.6.Final]
... 105 more
--
This message is automatically generated by JIRA.
For more information on JIRA, see: