"org.hibernate.MappingException: broken column mapping" in JBoss EAP

Solution Verified - Updated -

Issue

  • Encountering a failure during deployment of persistence unit:

    org.hibernate.MappingException: broken column mapping for: task.id of: org.test.entity.Assignee
    
  • Defined a @OneToOne unidirectional association with a derived key referencing non-primary key properties of the associated entity

    @Entity
    @IdClass(AssigneeId.class)
    public class Assignee {
            @Id
            private String pid;
    
            @Id
            private String tid;
    
            @OneToOne(cascade = CascadeType.ALL)
            @JoinColumns({
                    @JoinColumn(name = "pid", referencedColumnName="project", insertable = false, updatable = false),
                    @JoinColumn(name = "tid", referencedColumnName="tid", insertable = false, updatable = false)
            })
            private Task task;
            ...
    }
    
    @Entity
    public class Task {
            @Id
            private String name;
    
            private String project;
            private String tid;
            ...
    }
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7
  • Hibernate 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content