Can't delete a tracked entity in dhis2.25

Hi,
I need help,
i have upgraded our case based report system from 2.24 to version 2.25
Build revision:
9f6b262
Build date:
2017-02-16 06:42
The system looks working fine i can navigate in all apps, but while trying to delete a registered person in TB tracker program, the system pops up a confirmation window. After confriming the system displays the message " Error: Could no execute the statement". Here is the screen


Reading from the logs file here is the

  • INFO 2017-02-16 17:43:58,736 Deleted objects associated with object of type ProgramStageInstance (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:58,888 ‘akamugunga’ delete org.hisp.dhis.program.ProgramStageInstance, uid: x4vCP11wix6 (AuditLogUtil.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,050 Deleted objects associated with object of type ProgramInstance (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,051 ‘akamugunga’ delete org.hisp.dhis.program.ProgramInstance, uid: NEwNjmV50iU (AuditLogUtil.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,284 Deleted objects associated with object of type TrackedEntityAttributeValue (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,334 Deleted objects associated with object of type TrackedEntityAttributeValue (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,351 Deleted objects associated with object of type TrackedEntityAttributeValue (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,357 Deleted objects associated with object of type TrackedEntityAttributeValue (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,386 Deleted objects associated with object of type TrackedEntityAttributeValue (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,414 Deleted objects associated with object of type TrackedEntityAttributeValue (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,437 Deleted objects associated with object of type TrackedEntityAttributeValue (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,457 Deleted objects associated with object of type TrackedEntityAttributeValue (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,468 Deleted objects associated with object of type TrackedEntityAttributeValue (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,483 Deleted objects associated with object of type TrackedEntityInstance (DefaultDeletionManager.java [tomcat-http-2])
  • INFO 2017-02-16 17:43:59,514 ‘akamugunga’ delete org.hisp.dhis.trackedentity.TrackedEntityInstance, uid: SdalPo5bhdy (AuditLogUtil.java [tomcat-http-2])
  • WARN 2017-02-16 17:43:59,822 SQL Error: 0, SQLState: 23503 (SqlExceptionHelper.java [tomcat-http-2])
  • ERROR 2017-02-16 17:43:59,825 ERROR: update or delete on table “trackedentityinstance” violates foreign key constraint “fk_trackedentityauditid_trackedentityinstanceid” on table “trackedentityaudit”
    Detail: Key (trackedentityinstanceid)=(186670) is still referenced from table “trackedentityaudit”. (SqlExceptionHelper.java [tomcat-http-2])
  • ERROR 2017-02-16 17:43:59,827 HHH000346: Error during managed flush [could not execute statement] (SessionImpl.java [tomcat-http-2])
    org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_trackedentityauditid_trackedentityinstanceid]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
    at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:164)
    at org.springframework.orm.hibernate5.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:741)
    at org.springframework.orm.hibernate5.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:589)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:485)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy135.deleteTrackedEntityInstance(Unknown Source)
    at org.hisp.dhis.dxf2.events.trackedentity.AbstractTrackedEntityInstanceService.deleteTrackedEntityInstance(AbstractTrackedEntityInstanceService.java:439)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at com.sun.proxy.$Proxy232.deleteTrackedEntityInstance(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy192.deleteTrackedEntityInstance(Unknown Source)
    at org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController.deleteTrackedEntityInstance(TrackedEntityInstanceController.java:492)
    at org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$FastClassBySpringCGLIB$$cfbc2606.invoke()
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
    at org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$EnhancerBySpringCGLIB$$e98e183b.deleteTrackedEntityInstance()
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
    at org.springframework.web.servlet.FrameworkServlet.doDelete(FrameworkServlet.java:892)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:656)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(