org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

Stack Overflow | anything | 8 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.
  1. 0

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

    Stack Overflow | 8 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
  2. 0

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

    coderanch.com | 6 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]
  3. 0

    GitHub comment 1612#265380844

    GitHub | 4 months ago | fxprunayre
    org.springframework.dao.DataIntegrityViolationException: could not execute batch; SQL [insert into UserAddress (userid, addressid) values (?, ?)]; constraint ["PRIMARY_KEY_C6 ON PUBLIC.USERADDRESS(USERID, ADDRESSID) VALUES ( /* key:8 */ 3929, 3930)"; SQL statement: insert into UserAddress (userid, addressid) values (?, ?) [23505-174]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  1. linxiaolong 1 times, last 1 day ago
  2. treanz 7 times, last 9 months ago
4 unregistered visitors

Root Cause Analysis

  1. org.springframework.dao.DataIntegrityViolationException

    could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException()
  2. Spring ORM
    JpaTransactionManager.doCommit
    1. org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:259)
    2. org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:225)
    3. org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:521)
    3 frames
  3. Spring Tx
    TransactionInterceptor.invoke
    1. org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
    2. org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
    3. org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:485)
    4. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
    5. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    5 frames
  4. Spring AOP
    JdkDynamicAopProxy.invoke
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    2. org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    4. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    4 frames
  5. com.sun.proxy
    $Proxy126.deleteSchool
    1. com.sun.proxy.$Proxy126.deleteSchool(Unknown Source)
    1 frame
  6. com.sts.app
    SchoolController$$FastClassByCGLIB$$a5f9e3ee.invoke
    1. com.sts.app.school.web.SchoolController.deleteSchool(SchoolController.java:71)
    2. com.sts.app.school.web.SchoolController$$FastClassByCGLIB$$a5f9e3ee.invoke(<generated>)
    2 frames