> parameters.add(0, storedProcedureCall.getParameters()
> .get(0));
> parameters.add(1, measurement.getPatient().getId());
> parameters.add(2, measurementDateAsString);
> parameters.add(3, measurement
> .getValue(MeasurementValueKind.BODYSPO2));
> parameters.add(4, measurement
> .getValue(MeasurementValueKind.BODYPULSE2));
> parameters.add(5, measurement.getWorkflow().getId());
>
>
logger.info("result: " + result);
> storedProcedureCall.setParameters(parameters);
> result = (Integer) ((DatabaseRecord) session
> .executeSelectingCall(storedProcedureCall).get(0))
> .get("MEASUREMENT_ID");
> measurement.setId(result); // line 754
>
logger.info("generated measurementId:" + result); // line
> 755
> return result; }
>
> });
> }
>
> After saving the measurement using i printed out the generated id via a
> logger (see line 755) and i see this id. Since i set the id by calling
> setId(see line 754). I don't understand why i get the following exception
> on
> the second attempt to save. That means the first save call function
> properly
> since i find the data in the database, but the second doesn't.
>
> [EL Warning]: 2008.12.10
> 09:10:02.296--UnitOfWork(5651650)--Thread(Thread[http-8080-Processor25,5,main])--Exception
> [EclipseLink-7197] (Eclipse Persistence Services - 1.0.2 (Build
> 20081024)):
> org.eclipse.persistence.exceptions.ValidationException
> Exception Description: Null primary key encountered in unit of work clone
> [topcare.domain.patient.measurement.Measurement@1f].
> javax.persistence.RollbackException: Exception [EclipseLink-7197] (Eclipse
> Persistence Services - 1.0.2 (Build 20081024)):
> org.eclipse.persistence.exceptions.ValidationException
> Exception Description: Null primary key encountered in unit of work clone
> [topcare.domain.patient.measurement.Measurement@1f].
> at
> org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:102)
> at
> org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
> at topcare.domain.DAOFactory.commit(DAOFactory.java:510)
> at topcare.domain.UnitOfWork.commit(UnitOfWork.java:92)
> at
> topcare.service.MeasurementService.createMeasurement(MeasurementService.java:94)
> at
> topcare.ui.struts.measurement.MeasurementAction.execute(MeasurementAction.java:84)
> at
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
> at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
> at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
> at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
> 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:237)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
> at
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: Exception [EclipseLink-7197] (Eclipse Persistence Services -
> 1.0.2 (Build 20081024)):
> org.eclipse.persistence.exceptions.ValidationException
> Exception Description: Null primary key encountered in unit of work clone
> [topcare.domain.patient.measurement.Measurement@1f].
> at
> org.eclipse.persistence.exceptions.ValidationException.nullPrimaryKeyInUnitOfWorkClone(ValidationException.java:1305)
> at
> org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChanges(DeferredChangeDetectionPolicy.java:84)
> at
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateChanges(UnitOfWorkImpl.java:557)
> at
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1320)
> at
> org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:159)
> at
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1002)
> at
> org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84)
> ... 35 more
>
> Thanks for any help
>
>