KamoCRM

Resolve security_level SQL error caused by duplicate MEMBER_TYPE column in Hibernate 6

Fixkamo-shared-library
Shipped
16 ஏப்ரல், 2026 அன்று 3:22 AM UTC
Author
Kamo
Commit
f81e6ed

Member.java mapped MEMBER_TYPE both as @DiscriminatorColumn and as an explicit @Column field. Hibernate 6 selected the column twice in the parent table projection, causing a column-count drift that pushed security_level into the child table (member_team_member) SELECT — where it does not exist. Fix: remove the @Column JPA mapping from memberType and derive it at runtime via instanceof in a custom getMemberType() getter. MemberRepository's JPQL query is updated to use TYPE(m) for discriminator-based filtering, with a default bridge method preserving the existing API signature for all callers.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing