← Back to team overview

dhis2-devs team mailing list archive

Re: Can't unselect/delete relationship when editing program

 

Hi Harsh,

To delete that relationship type, you have to first remove that
relationship type from the programs using that relationship.
Also make sure that the persons who enrolled in that program don't have any
relationship of that "relationship-type" with another persons.

There is a bug when we remove the relationship type from programs.
It is fixed in version 2.19 ( R. 19154 ) and trunk ( R. 19172 ).
So update your DHIS to this version and then try to delete relationship
type from the programs and existing person relationship.

............................

Best regards,
Tran Chau.


On Thu, May 21, 2015 at 2:44 PM, Harsh Atal <harsh.atal@xxxxxxxxx> wrote:

> Hi
>
> We added a relationship type which was added to a program. But now we need
> to delete it. But when we try to do so nothing happens except the progress
> bar keeps moving. Here is the stack trace from my local instance:
>
> *INFO  2015-05-21 12:56:04,619 'admin' delete
> org.hisp.dhis.relationship.RelationshipType, name: Eq/Mo, uid: K7kjkslt5w7
> (AuditLogUtil.java [http-bio-8090-exec-9])*
> ** WARN  2015-05-21 12:56:04,655 SQL Error: 0, SQLState: 23503
> (SqlExceptionHelper.java [http-bio-8090-exec-9])*
> ** ERROR 2015-05-21 12:56:04,656 ERROR: update or delete on table
> "relationshiptype" violates foreign key constraint
> "fk_program_relationshipid" on table "program"*
> *  Detail: Key (relationshiptypeid)=(355) is still referenced from table
> "program". (SqlExceptionHelper.java [http-bio-8090-exec-9])*
> ** ERROR 2015-05-21 12:56:04,766 Error while executing action
> (ExceptionInterceptor.java [http-bio-8090-exec-9])*
> *org.springframework.dao.DataIntegrityViolationException: could not
> execute statement; SQL [n/a]; constraint [fk_program_relationshipid];
> nested exception is org.hibernate.exception.ConstraintViolationException:
> could not execute statement*
> * at
> org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)*
> * at
> org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730)*
> * at
> org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592)*
> * at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)*
> *.*
> *.*
> *.*
> *.*
>
> In view of the above error we have tried to delete the relationship from
> the program (by editing it) but it seems that there is no way in which this
> can be done.Please confirm.
>
> Any help is appreciated.
>
>
> Regards
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References