Migration 5.6 -> 6.2: Problem if discriminator is the ID in a @Immutable

Hello, the following Mapping was legal in Hibernate 4 and 5 (for 10 years or more). It’s a readonly (@Immutable) Metamodel class. In 6.2. I’m getting a MappingException “mandant”-column is duplicated. Note, the column is both ID and Discriminator. Addition of insertable=false, updatable=false doesnt cure. Any suggestions?

@Table(name = "ecm_meta.t_mandanten")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "mandant", discriminatorType = DiscriminatorType.INTEGER)
@DiscriminatorOptions(force = false, insert = false)
public abstract class Mandant implements Serializable {
  private static final long serialVersionUID = 7098735388830268631L;

  @Column(name = "mandant")
  private Integer mandant;

  // other omitted

Could be a bug. Please try updating to 6.2.5.Final and if that doesn’t fix your problem, please create an issue in the issue tracker(https://hibernate.atlassian.net) with a test case(hibernate-test-case-templates/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java at main · hibernate/hibernate-test-case-templates · GitHub) that reproduces the issue.

Thanks for the reply. I just realized that we’r chained to ORM 6.1. because of the underlying Weblogic 14.1. with JEE 8 → Jakarta 3.0 max. With ORM 6.2. I’m getting the well-known Error “java.lang.NoSuchFieldError: UUID” saying the app server isn’t ready for this.

I don’t know when Oracle plans to release a Jakarta EE 10 compatible version, but I’m pretty sure it will “just work” if you replace the JAR of the Jakarta Persistence API with the 3.1.0 version.