DataIntegrityViolationException thrown in user datum export

XMLWordPrintable

      Got the following exception in production, which seems like a bug somewhere:

      [2022-04-19 23:30:54.298] ERROR [http-nio-9081-exec-4696 ] .c.w.s.WebServiceGlobalControllerSupport RuntimeException in request uri=/solaruser/u/sec/export/configs/data/50?; user [xxx@xxx]
      org.springframework.dao.DataIntegrityViolationException: 
      ### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "user_export_data_conf" violates foreign key constraint "user_export_datum_conf_data_fk" on table "user_export_datum_conf"
        Detail: Key (id)=(50) is still referenced from table "user_export_datum_conf".
      ### The error may exist in URL [jar:file:/workspace/WEB-INF/lib/solarnet-user-datum-1.0.1.jar!/net/solarnetwork/central/user/export/dao/mybatis/map/UserDataConfiguration.xml]
      ### The error may involve net.solarnetwork.central.user.export.domain.UserDataConfiguration.delete-UserDataConfiguration-Inline
      ### The error occurred while setting parameters
      ### SQL: DELETE FROM solaruser.user_export_data_conf   WHERE id = ? AND user_id = ?
      ### Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "user_export_data_conf" violates foreign key constraint "user_export_datum_conf_data_fk" on table "user_export_datum_conf"
        Detail: Key (id)=(50) is still referenced from table "user_export_datum_conf".
      ; ERROR: update or delete on table "user_export_data_conf" violates foreign key constraint "user_export_datum_conf_data_fk" on table "user_export_datum_conf"
        Detail: Key (id)=(50) is still referenced from table "user_export_datum_conf".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "user_export_data_conf" violates foreign key constraint "user_export_datum_conf_data_fk" on table "user_export_datum_conf"
        Detail: Key (id)=(50) is still referenced from table "user_export_datum_conf".
          at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:251) ~[spring-jdbc-5.3.16.jar:5.3.16]
          at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70) ~[spring-jdbc-5.3.16.jar:5.3.16]
          at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91) ~[mybatis-spring-2.0.6.jar:2.0.6]
          at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441) ~[mybatis-spring-2.0.6.jar:2.0.6]
          at com.sun.proxy.$Proxy89.delete(Unknown Source) ~[na:na]
          at org.mybatis.spring.SqlSessionTemplate.delete(SqlSessionTemplate.java:304) ~[mybatis-spring-2.0.6.jar:2.0.6]
          at net.solarnetwork.central.user.dao.mybatis.BaseMyBatisUserRelatedGenericDao.delete(BaseMyBatisUserRelatedGenericDao.java:94) ~[solarnet-user-1.0.0.jar:1.0.0]
          at net.solarnetwork.central.user.dao.mybatis.BaseMyBatisUserRelatedGenericDao.delete(BaseMyBatisUserRelatedGenericDao.java:59) ~[solarnet-user-1.0.0.jar:1.0.0]
          at net.solarnetwork.central.user.dao.mybatis.BaseMyBatisUserRelatedGenericDao$$FastClassBySpringCGLIB$$2481448a.invoke(<generated>) ~[solarnet-user-1.0.0.jar:1.0.0]
          at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) ~[spring-tx-5.3.16.jar:5.3.16]
          at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) ~[spring-tx-5.3.16.jar:5.3.16]
          at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698) ~[spring-aop-5.3.16.jar:5.3.16]
          at net.solarnetwork.central.user.export.dao.mybatis.MyBatisUserDataConfigurationDao$$EnhancerBySpringCGLIB$$adad92d2.delete(<generated>) ~[solarnet-user-datum-1.0.1.jar:1.0.1]
          at net.solarnetwork.central.user.export.biz.dao.DaoUserExportBiz.deleteConfiguration(DaoUserExportBiz.java:251) ~[solarnet-user-datum-1.0.1.jar:1.0.1]
          at net.solarnetwork.central.user.export.biz.dao.DaoUserExportBiz$$FastClassBySpringCGLIB$$c5e48959.invoke(<generated>) ~[solarnet-user-datum-1.0.1.jar:1.0.1]
          at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:58) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) ~[spring-tx-5.3.16.jar:5.3.16]
          at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) ~[spring-tx-5.3.16.jar:5.3.16]
          at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.16.jar:5.3.16]
          at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698) ~[spring-aop-5.3.16.jar:5.3.16]
          at net.solarnetwork.central.user.export.biz.dao.DaoUserExportBiz$$EnhancerBySpringCGLIB$$71194bc.deleteConfiguration(<generated>) ~[solarnet-user-datum-1.0.1.jar:1.0.1]
          at net.solarnetwork.central.reg.web.api.v1.DatumExportController.deleteDataConfiguration(DatumExportController.java:293) ~[classes/:na]
      

            Assignee:
            Matt Magoffin
            Reporter:
            Matt Magoffin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: