Legacy UI Crash on RelationshipType Deletion

Hi everyone, I encountered an issue while testing the Legacy UI while working on some contributions.

Bug Report: Legacy UI Crash on RelationshipType Deletion

Issue: Deleting a RelationshipType previously assigned to a patient triggers a LazyInitializationException crash instead of a standard validation error.

Observation: Database deletion fails due to a foreign key constraint (openmrs.relationship) since we are soft deleting. Note: This happens even if the RelationshipType was unassigned (voided) from all patients before deletion.

Root Cause: The errorhandler.jsp attempts to access personName on a User proxy (likely the creator or voidedBy user) after the Hibernate session has closed.

Relevant logs:

ERROR - BatchingBatch.performExecution(134) | Cannot delete or update a parent row: a foreign key constraint fails (openmrs.relationship…) ERROR - errorhandler_jsp._jspService(209) | Error on page /openmrs/errorhandler.jspjavax.el.ELException: Error reading [personName] on type [org.openmrs.User$HibernateProxy$DuQVv9de] Caused by: org.hibernate.LazyInitializationException: could not initialize proxy [org.openmrs.User#1] - no Session at org.openmrs.User$HibernateProxy$DuQVv9de.getPersonName(Unknown Source)

I’m planning to open a ticket to fix the crash on the error view unless this is known behavior?