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

Fixkamo-shared-library
Shipped
April 16, 2026 at 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?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing