"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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.