org.hibernate.HibernateException: The database returned no natively generated identity value

Stack Overflow | javatechnology | 10 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.

Root Cause Analysis

  1. org.hibernate.HibernateException

    The database returned no natively generated identity value

    at org.hibernate.id.IdentifierGeneratorHelper.getGeneratedIdentity()
  2. Hibernate
    SessionImpl.saveOrUpdate
    1. org.hibernate.id.IdentifierGeneratorHelper.getGeneratedIdentity(IdentifierGeneratorHelper.java:91)
    2. org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:100)
    3. org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:58)
    4. org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3032)
    5. org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3558)
    6. org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:98)
    7. org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:490)
    8. org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:195)
    9. org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:179)
    10. org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:214)
    11. org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:324)
    12. org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:288)
    13. org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:194)
    14. org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125)
    15. org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:209)
    16. org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:194)
    17. org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:114)
    18. org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
    19. org.hibernate.internal.SessionImpl.fireSaveOrUpdate(SessionImpl.java:684)
    20. org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:676)
    21. org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:671)
    21 frames
  3. Spring Batch Infrastructure
    HibernateItemWriter.write
    1. org.springframework.batch.item.database.HibernateItemWriter.doWrite(HibernateItemWriter.java:140)
    2. org.springframework.batch.item.database.HibernateItemWriter.write(HibernateItemWriter.java:113)
    2 frames
  4. Spring Batch Core
    TaskletStep$ChunkTransactionCallback.doInTransaction
    1. org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:175)
    2. org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:151)
    3. org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:274)
    4. org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:199)
    5. org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75)
    6. org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
    7. org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
    7 frames
  5. Spring Tx
    TransactionTemplate.execute
    1. org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    1 frame
  6. Spring Batch Core
    StepContextRepeatCallback.doInIteration
    1. org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
    2. org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)
    2 frames
  7. Spring Batch Infrastructure
    RepeatTemplate.iterate
    1. org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374)
    2. org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
    3. org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
    3 frames
  8. Spring Batch Core
    SimpleJobLauncher$1.run
    1. org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257)
    2. org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:200)
    3. org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148)
    4. org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64)
    5. org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67)
    6. org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:169)
    7. org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144)
    8. org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:134)
    9. org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:306)
    10. org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135)
    10 frames
  9. Spring Core
    SyncTaskExecutor.execute
    1. org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
    1 frame
  10. Spring Batch Core
    SimpleJobLauncher.run
    1. org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:128)
    1 frame
  11. com.websystique.springbatch
    Main.main
    1. com.websystique.springbatch.Main.main(Main.java:22)
    1 frame