- Shipped
- April 20, 2026 at 8:59 PM UTC
- Author
- Kamo
- Commit
- ea4a85b
Hibernate @Enumerated(EnumType.ORDINAL) writes/reads the declaration-index of the enum. When a RoleRightType value is removed (e.g. MANAGE_USERS, id=19), every subsequent entry's ordinal shifts down by one while getId() stays put — creating a silent divergence. In this codebase the raw-SQL upsert **************** has always written getId(), so after MANAGE_USERS was removed + new rights added the DB now holds right_type values (e.g. 136) that exceed RoleRightType.values().length, causing Hibernate to throw ArrayIndexOutOfBoundsException on read and crash startup. Introduce RoleRightTypeIdConverter **************** Integer>) that round-trips via getId(). Apply to all five ORDINAL-mapped right tables: - OrgRoleRight - MemberRight - JobTitleRight - DepartmentRight - MemberRightsApplied Unknown ids convert back to null so **************** can clean them up on the next boot rather than crashing. The column data already matches getId() (that's what insertIfAbsent writes), so no migration is needed — the converter aligns Hibernate with what's actually stored.