org.hibernate.MappingException: property [id.companyId] not found on entity

Viewed 500

I am in the process of upgrading from Hibernate 5.0 to 5.3 and I am running into an unexpected issue.

My Entity class looks like this:

@Entity
@Table( name="USER_CUSTOMER_MAPPING",
    uniqueConstraints={ @UniqueConstraint( columnNames={ "USER_NAME", "COMPANY_ID", "CUSTOMER_ID" } ) })
@IdClass( UserCustomerMappingId.class )
public class UserCustomerMapping implements Cloneable, Serializable
{
    @Id
    @Column( name="USER_NAME", nullable=false, updatable=false )
    @Index( name="USER_CUSTOMER_MAPPING_USER_NAME_INDEX" )
    @NotNull
    private String userName = null;

    @Id
    @Column( name="COMPANY_ID", nullable=false, length=100 )
    @Index( name="USER_CUSTOMER_MAPPING_COMPANY_ID_INDEX" )
    @NotNull
    @Length( max=100 )
    private String companyId = null;

    @Id
    @Column( name="CUSTOMER_ID", nullable=false )
    @Index( name="USER_CUSTOMER_MAPPING_CUSTOMER_ID_INDEX" )
    @NotNull
    private String customerId = null;

  // rest has been abbreviated for brevity
}

My composite key class looks like this:

public class UserCustomerMappingId implements Cloneable, Serializable
{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private String userName = null;
    private String companyId = null;
    private String customerId = null;

    public UserCustomerMappingId()
    {
        super();
    }

  // getters and setters omitted for brevity
}

The above works perfectly on Hibernate 5.0, but encounters the below MappingException when run deployed on Hibernate 5.3 (this is being encountered as I attempt to upgrade from WildFly 10 to WildFly 19). This occurs while the PersistenceUnit is starting.

org.hibernate.MappingException: property [id.companyId] not found on entity [...UserCustomerMapping]

I have made no other source nor configuration changes, What am I missing or do I need to change to make the above work with Hibernate 5.3 (WildFly 19) please?

0 Answers
Related