org.springframework.dao.DataIntegrityViolationException: a different object with the same identifier value was already associated with the session: [example.Type2#0c1c7b07-7b8d-4ce9-b08c-5eee572c8440]; nested exception is : a different object with the same identifier value was already associated with the session: [example.Type2#0c1c7b07-7b8d-4ce9-b08c-5eee572c8440]

coderanch.com | 2 months ago
  1. 0

    Changing entity type (discriminator value) in JPA [Solved] (Object Relational Mapping forum at Coderanch)

    coderanch.com | 2 months ago
    org.springframework.dao.DataIntegrityViolationException: a different object with the same identifier value was already associated with the session: [example.Type2#0c1c7b07-7b8d-4ce9-b08c-5eee572c8440]; nested exception is : a different object with the same identifier value was already associated with the session: [example.Type2#0c1c7b07-7b8d-4ce9-b08c-5eee572c8440]
  2. 0

    Spring data JPA repository delete query getting fired after returning from service

    Stack Overflow | 4 months ago | anything
    org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
  3. 0

    GitHub comment 52#151558461

    GitHub | 1 year ago | ghsnd
    org.springframework.dao.DataIntegrityViolationException: A different object with the same identifier value was already associated with the session : [eu.freme.common.persistence.model.Template#1]; nested exception is javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [eu.freme.common.persistence.model.Template#9]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Removing an entity and create new one with same primary key

    Stack Overflow | 11 months ago | Dmitry Shipaev
    org.springframework.dao.DataIntegrityViolationException: A different object with the same identifier value was already associated with the session : [com.test.core.model.subsubentity.SubSubEntity#3440120160113000103]; nested exception is javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [com.test.core.model.subsubentity.SubSubEntity#3440120160113000103]
  6. 0

    Hi, restoring a page from trash doesn't work. It says, the cause is: org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: [com.atlassian.confluence.pages.attachments.ImageDetailsDto#125307008]; SQL []; Violation of PRIMARY KEY constraint 'PK__IMAGEDET__23CEF7B0117F9D94'. Cannot insert duplicate key in object 'dbo.IMAGEDETAILS'. The duplicate key value is (125307008).; nested exception is java.sql.SQLException: Violation of PRIMARY KEY constraint 'PK__IMAGEDET__23CEF7B0117F9D94'. Cannot insert duplicate key in object 'dbo.IMAGEDETAILS'. The duplicate key value is (125307008). at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:100) caused by: java.sql.SQLException: Violation of PRIMARY KEY constraint 'PK__IMAGEDET__23CEF7B0117F9D94'. Cannot insert duplicate key in object 'dbo.IMAGEDETAILS'. The duplicate key value is (125307008). at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) What should we do? Best regards, Mario

    Atlassian JIRA | 2 years ago | Mario Reissmann
    org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: [com.atlassian.confluence.pages.attachments.ImageDetailsDto#125307008]; SQL []; Violation of PRIMARY KEY constraint 'PK__IMAGEDET__23CEF7B0117F9D94'. Cannot insert duplicate key in object 'dbo.IMAGEDETAILS'. The duplicate key value is (125307008).; nested exception is java.sql.SQLException: Violation of PRIMARY KEY constraint 'PK__IMAGEDET__23CEF7B0117F9D94'. Cannot insert duplicate key in object 'dbo.IMAGEDETAILS'. The duplicate key value is (125307008).

  1. treanz 7 times, last 5 months ago
4 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.springframework.dao.DataIntegrityViolationException

    a different object with the same identifier value was already associated with the session: [example.Type2#0c1c7b07-7b8d-4ce9-b08c-5eee572c8440]; nested exception is : a different object with the same identifier value was already associated with the session: [example.Type2#0c1c7b07-7b8d-4ce9-b08c-5eee572c8440]

    at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible()
  2. Spring ORM
    JpaTransactionManager.doCommit
    1. org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:313)
    2. org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:106)
    3. org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:516)
    3 frames
  3. Spring Tx
    TransactionInterceptor.invoke
    1. org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
    2. org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
    3. org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:387)
    4. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
    4 frames
  4. Spring AOP
    JdkDynamicAopProxy.invoke
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    2 frames
  5. com.sun.proxy
    $Proxy44.addPunt
    1. com.sun.proxy.$Proxy44.addPunt(Unknown Source)
    1 frame
  6. example
    TestTypeAdd.execute
    1. example.TestTypeAdd.execute(TestTypeAdd.java:31)
    1 frame
  7. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:597)
    4 frames
  8. JUnit
    InvokeMethod.evaluate
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    4 frames
  9. Spring TestContext
    SpringJUnit4ClassRunner.runChild
    1. org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    2. org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
    3. org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    4. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    5. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
    5 frames
  10. JUnit
    ParentRunner$2.evaluate
    1. org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    2. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    3. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    4. org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    5. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    5 frames
  11. Spring TestContext
    RunAfterTestClassCallbacks.evaluate
    1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
    2 frames
  12. JUnit
    ParentRunner.run
    1. org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    1 frame
  13. Spring TestContext
    SpringJUnit4ClassRunner.run
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    1 frame
  14. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    1 frame
  15. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    5 frames