Skip to content

Commit ff81fbe

Browse files
vishwab1claude
andcommitted
fix: add missing @transactional to softDeleteOldMappings
InvalidDataAccessApiUsageException: "Executing an update/delete query" - a @Modifying UPDATE query with no surrounding transaction. Pre-existing bug in shared code (updateUserRoleMapping, used by every service line), dormant until now: Stop TB's Edit form was always invalid before today's fixes (Update button permanently disabled), so nothing ever reached this code path through Stop TB specifically. Same pattern the other @Modifying query in this file already follows correctly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 970f303 commit ff81fbe

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/main/java/com/iemr/admin/repo/employeemaster/EmployeeMasterRepo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ boolean existsByUserIDAndRoleIDAndProviderServiceMapIDAndFacilityIDAndDeletedFal
156156
long countByUserIDAndRoleIDAndDeletedFalse(Integer userID, Integer roleID);
157157

158158
// Soft-delete old duplicate mappings for same user+service, excluding the current row being updated
159+
@Transactional
159160
@Modifying
160161
@Query("UPDATE M_UserServiceRoleMapping2 u SET u.deleted = true WHERE u.userID = :userID AND u.providerServiceMapID = :providerServiceMapID AND u.uSRMappingID != :excludeUSRMappingID AND u.deleted = false")
161162
int softDeleteOldMappings(@Param("userID") Integer userID, @Param("providerServiceMapID") Integer providerServiceMapID, @Param("excludeUSRMappingID") Integer excludeUSRMappingID);

0 commit comments

Comments
 (0)