[DATAJPA-441] Insertion of NULL as ID despite using @SequenceGenerator Created: 06/Jan/14 Updated: 29/Jan/14 Resolved: 29/Jan/14 Status: Project: Component/s: Affects Version/s: Fix Version/s: Resolved Spring Data JPA Core 1.4.2 (Babbage SR1) Type: Reporter: Resolution: Labels: Remaining Estimate: Time Spent: Original Estimate: Bug Dennis Böttcher Cannot Reproduce None Not Specified Attachments: spring-data-jpa-bugs-datajpa-441.zip Oliver Gierke 42 - 2014 Kickoff Last updater: Sprint: None Priority: Assignee: Votes: Major Oliver Gierke 0 Not Specified Not Specified Description After updating from Spring Data JPA 1.3.4.RELEASE to 1.4.2.RELEASE I get an Oracle error when creating ne org.springframework.orm.jpa.JpaSystemException: Exception [EclipseLink-400 org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.BatchUpdateException: ORA-01400: Einfügen von Error Code: 1400; nested exception is javax.persistence.PersistenceExcepti org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.BatchUpdateException: ORA-01400: Einfügen von Error Code: 1400 at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAc at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIf at org.springframework.dao.support.ChainedPersistenceExceptionTransla at org.springframework.dao.support.DataAccessUtils.translateIfNecessa at org.springframework.dao.support.PersistenceExceptionTranslationInt at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.data.jpa.repository.support.LockModeRepositoryPostProc at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.aop.interceptor.ExposeInvocationInterceptor.in at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDyn at com.sun.proxy.$Proxy102.findOneByBaseModelAndModelExtensionsAndMod at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorIm at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingRefle at org.springframework.aop.framework.ReflectiveMethodInvocation.invok at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoin at com.repaced.cdb.util.tracing.RepositoryTracingAspect.trace(Reposit at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdvice at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdvice at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJ at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.transaction.interceptor.TransactionInterceptor at org.springframework.transaction.interceptor.TransactionAspectSuppo at org.springframework.transaction.interceptor.TransactionInterceptor at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.aop.interceptor.ExposeInvocationInterceptor.in at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDyn at com.sun.proxy.$Proxy103.findOneByBaseModelAndModelExtensionsAndMod at com.repaced.content.initialization.techdata.PreModelVersionInitial at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorIm at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingRefle at org.springframework.aop.framework.ReflectiveMethodInvocation.invok at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.transaction.interceptor.TransactionInterceptor at org.springframework.transaction.interceptor.TransactionAspectSuppo at org.springframework.transaction.interceptor.TransactionInterceptor at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDyn at com.sun.proxy.$Proxy104.getValues(Unknown Source) at com.repaced.content.initialization.InitializationServiceImpl.initi at sun.reflect.GeneratedMethodAccessor200.invoke(Unknown Source) at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc java.lang.reflect.Method.invoke(Method.java:606) org.springframework.aop.support.AopUtils.invokeJoinpointUsingRefle org.springframework.aop.framework.ReflectiveMethodInvocation.invok org.springframework.aop.framework.ReflectiveMethodInvocation.proce org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoin com.repaced.util.tracing.ServiceTracingAspect.trace(ServiceTracing sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc java.lang.reflect.Method.invoke(Method.java:606) org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdvice org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdvice org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJ org.springframework.aop.framework.ReflectiveMethodInvocation.proce org.springframework.transaction.interceptor.TransactionInterceptor org.springframework.transaction.interceptor.TransactionAspectSuppo org.springframework.transaction.interceptor.TransactionInterceptor org.springframework.aop.framework.ReflectiveMethodInvocation.proce org.springframework.aop.interceptor.ExposeInvocationInterceptor.in org.springframework.aop.framework.ReflectiveMethodInvocation.proce org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDyn com.sun.proxy.$Proxy143.initialize(Unknown Source) com.repaced.content.PropertiesContentSlotsManager.manageContentSlo sun.reflect.GeneratedMethodAccessor204.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc java.lang.reflect.Method.invoke(Method.java:606) org.springframework.aop.support.AopUtils.invokeJoinpointUsingRefle org.springframework.aop.framework.ReflectiveMethodInvocation.invok org.springframework.aop.framework.ReflectiveMethodInvocation.proce org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoin com.repaced.util.tracing.ServiceTracingAspect.trace(ServiceTracing sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc java.lang.reflect.Method.invoke(Method.java:606) org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdvice org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdvice org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJ org.springframework.aop.framework.ReflectiveMethodInvocation.proce org.springframework.transaction.interceptor.TransactionInterceptor org.springframework.transaction.interceptor.TransactionAspectSuppo org.springframework.transaction.interceptor.TransactionInterceptor org.springframework.aop.framework.ReflectiveMethodInvocation.proce org.springframework.aop.interceptor.ExposeInvocationInterceptor.in org.springframework.aop.framework.ReflectiveMethodInvocation.proce org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDyn com.sun.proxy.$Proxy144.manageContentSlotsForQualifier(Unknown Sou com.repaced.structure.job.QualifierCreationTasklet.execute(Qualifi at com.repaced.job.tasklet.BasicTasklet.execute(BasicTasklet.java:268 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorIm at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingRefle at org.springframework.aop.framework.ReflectiveMethodInvocation.invok at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.aop.interceptor.ExposeInvocationInterceptor.in at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDyn at com.sun.proxy.$Proxy86.execute(Unknown Source) at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTrans at org.springframework.transaction.support.TransactionTemplate.execut at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChun at org.springframework.batch.core.scope.context.StepContextRepeatCall at org.springframework.batch.repeat.support.RepeatTemplate.getNextRes at org.springframework.batch.repeat.support.RepeatTemplate.executeInt at org.springframework.batch.repeat.support.RepeatTemplate.iterate(Re at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute( at org.springframework.batch.core.step.AbstractStep.execute(AbstractS at org.springframework.batch.core.job.SimpleStepHandler.handleStep(Si at org.springframework.batch.core.job.flow.JobFlowExecutor.executeSte at org.springframework.batch.core.job.flow.support.state.StepState.ha at org.springframework.batch.core.job.flow.support.SimpleFlow.resume( at org.springframework.batch.core.job.flow.support.SimpleFlow.start(S at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob. at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob at org.springframework.batch.core.launch.support.SimpleJobLauncher$1. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecut at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecu at java.lang.Thread.run(Thread.java:724) Caused by: javax.persistence.PersistenceException: Exception [EclipseLinkorg.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.BatchUpdateException: ORA-01400: Einfügen von Error Code: 1400 at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(Entit at org.eclipse.persistence.internal.jpa.QueryImpl.performPreQueryFlus at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(Qu at org.eclipse.persistence.internal.jpa.QueryImpl.getSingleResult(Que at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult( at org.springframework.data.jpa.repository.query.JpaQueryExecution$Si at org.springframework.data.jpa.repository.query.JpaQueryExecution.ex at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doE at org.springframework.data.jpa.repository.query.AbstractJpaQuery.exe at org.springframework.data.repository.core.support.RepositoryFactory at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.transaction.interceptor.TransactionInterceptor at org.springframework.transaction.interceptor.TransactionAspectSuppo at org.springframework.transaction.interceptor.TransactionInterceptor at org.springframework.aop.framework.ReflectiveMethodInvocation.proce at org.springframework.dao.support.PersistenceExceptionTranslationInt ... 126 more Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2. Internal Exception: java.sql.BatchUpdateException: ORA-01400: Einfügen von Error Code: 1400 at org.eclipse.persistence.exceptions.DatabaseException.sqlException( at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.e at org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWriti at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.w at org.eclipse.persistence.internal.sessions.AbstractSession.writesCo at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.writesCom at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWor at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(Entit ... 141 more Caused by: java.sql.BatchUpdateException: ORA-01400: Einfügen von NULL in at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePrep at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleState at org.eclipse.persistence.platform.database.oracle.Oracle10Platform. at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.e ... 147 more Unfortunately I have no complete test case for that but I will try to provide one. I have also checked the 1.4.3.RELEASE and get the same error. The problem is that the default value of the ID field (null) will be tried to set which is not possible for an ID field The mechanism which automatically gets the next ID (e.g. from a sequence) seems not to work. I hope the stacktrace will help you by fixing the problem. Best regards Comments Comment by Thomas Darimont [ 06/Jan/14 ] Hi, did you also use Eclipse-Link 2.5.1 with Spring Data JPA 1.3.4 or a different eclipse-link version? Cheers, Thomas Comment by Dennis Böttcher [ 06/Jan/14 ] I have checked various combinations: EL 2.5.1 + SD JPA 1.3.4 - WORKING EL 2.5.0 + SD JPA 1.3.4 - WORKING EL 2.5.0 + SD JPA 1.4.2 - NOT WORKING EL 2.5.1 + SD JPA 1.4.2 - NOT WORKING Best regars Comment by Thomas Darimont [ 07/Jan/14 ] I attached an example project: (SD JPA 1.4.3, Eclipse-Link 2.5.1, Oracle, Entity with sequence generated id) Since I couldn't reproduce your issue, could you give it a spin? Comment by Dennis Böttcher [ 08/Jan/14 ] Unfortunately I have no example project for this problem. It seems not to be a general problem but a special one perhaps in combination with Spring Batch. I am running a Spring Batch job which creates entities and results in this error. I will try to provide an example project but I think it will be hard to create one. Comment by Dennis Böttcher [ 29/Jan/14 ] Sorry but I have still no working example project found for this problem. Comment by Oliver Gierke [ 29/Jan/14 ] So what do you think, shall we close the ticket with "Cannot reproduce" for now and you reopen it in case you see this again? Comment by Dennis Böttcher [ 29/Jan/14 ] I think thats ok. If I still get this error with a newer version I will recreate an issue for that. Comment by Oliver Gierke [ 29/Jan/14 ] It's fine to just reopen this one here . Fingers crossed you just don't run into it anymore! Generated at Wed May 17 16:17:38 UTC 2017 using JIRA 6.4.14#64029sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.