org.hibernate.MappingException: Repeated column in mapping for entity: org.jboss.ejb3.test.composite2.Composite column: id2 (should be mapped with insert="false" update="false")

Hibernate JIRA | Bill Burke | 1 decade ago
  1. 0

    You can tone done the priority, but this is a regression from JBoss EJB 3.0 Preview 4, so we need to fix it before JBoss EJB 3.0 Preview 5. Deployment stack trace, then actual entities follow: 22:21:30,437 WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=composite2-test.ejb3 org.hibernate.MappingException: Repeated column in mapping for entity: org.jboss.ejb3.test.composite2.Composite column: id2 (should be mapped with insert="false" update="false") at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:487) at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:504) at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:521) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:318) at org.hibernate.mapping.RootClass.validate(RootClass.java:186) at org.hibernate.cfg.Configuration.validate(Configuration.java:815) -------------- @Entity public class Composite implements Serializable { private CompositePK pk; private CompositeContainer container; @EmbeddedId({ @AttributeOverride(name = "id1"), @AttributeOverride(name = "id2") }) public CompositePK getPk() { return pk; } public void setPk(CompositePK pk) { this.pk = pk; } @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="id2") public CompositeContainer getContainer() { return container; } public void setContainer(CompositeContainer container) { this.container = container; } } @Entity public class CompositeContainer implements Serializable { private long id; private Set<Composite> composites; @Id public long getId() { return id; } public void setId(long id) { this.id = id; } @OneToMany(mappedBy="container") public Set<Composite> getComposites() { return composites; } public void setComposites(Set<Composite> composites) { this.composites = composites; } } @Embeddable public class CompositePK implements Serializable { private long id1; private long id2; public CompositePK() { } public CompositePK(long id1, long id2) { this.id1 = id1; this.id2 = id2; } public long getId1() { return id1; } public void setId1(long id1) { this.id1 = id1; } public long getId2() { return id2; } public void setId2(long id2) { this.id2 = id2; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof CompositePK)) return false; final CompositePK compositePK = (CompositePK) o; if (id1 != compositePK.id1) return false; if (id2 != compositePK.id2) return false; return true; } public int hashCode() { int result; result = (int) (id1 ^ (id1 >>> 32)); result = 29 * result + (int) (id2 ^ (id2 >>> 32)); return result; } }

    Hibernate JIRA | 1 decade ago | Bill Burke
    org.hibernate.MappingException: Repeated column in mapping for entity: org.jboss.ejb3.test.composite2.Composite column: id2 (should be mapped with insert="false" update="false")
  2. 0

    You can tone done the priority, but this is a regression from JBoss EJB 3.0 Preview 4, so we need to fix it before JBoss EJB 3.0 Preview 5. Deployment stack trace, then actual entities follow: 22:21:30,437 WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=composite2-test.ejb3 org.hibernate.MappingException: Repeated column in mapping for entity: org.jboss.ejb3.test.composite2.Composite column: id2 (should be mapped with insert="false" update="false") at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:487) at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:504) at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:521) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:318) at org.hibernate.mapping.RootClass.validate(RootClass.java:186) at org.hibernate.cfg.Configuration.validate(Configuration.java:815) -------------- @Entity public class Composite implements Serializable { private CompositePK pk; private CompositeContainer container; @EmbeddedId({ @AttributeOverride(name = "id1"), @AttributeOverride(name = "id2") }) public CompositePK getPk() { return pk; } public void setPk(CompositePK pk) { this.pk = pk; } @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="id2") public CompositeContainer getContainer() { return container; } public void setContainer(CompositeContainer container) { this.container = container; } } @Entity public class CompositeContainer implements Serializable { private long id; private Set<Composite> composites; @Id public long getId() { return id; } public void setId(long id) { this.id = id; } @OneToMany(mappedBy="container") public Set<Composite> getComposites() { return composites; } public void setComposites(Set<Composite> composites) { this.composites = composites; } } @Embeddable public class CompositePK implements Serializable { private long id1; private long id2; public CompositePK() { } public CompositePK(long id1, long id2) { this.id1 = id1; this.id2 = id2; } public long getId1() { return id1; } public void setId1(long id1) { this.id1 = id1; } public long getId2() { return id2; } public void setId2(long id2) { this.id2 = id2; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof CompositePK)) return false; final CompositePK compositePK = (CompositePK) o; if (id1 != compositePK.id1) return false; if (id2 != compositePK.id2) return false; return true; } public int hashCode() { int result; result = (int) (id1 ^ (id1 >>> 32)); result = 29 * result + (int) (id2 ^ (id2 >>> 32)); return result; } }

    Hibernate JIRA | 1 decade ago | Bill Burke
    org.hibernate.MappingException: Repeated column in mapping for entity: org.jboss.ejb3.test.composite2.Composite column: id2 (should be mapped with insert="false" update="false")
  3. 0

    Hibernate mapping a map

    Stack Overflow | 4 years ago | user2171809
    org.hibernate.MappingException: Could not determine type for: java.util.Map, at table: social_item, for columns: [org.hibernate.mapping.Column(stats)]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to solve org.hibernate.MappingException?

    Stack Overflow | 5 years ago | Arne
    org.hibernate.MappingException: Could not determine type for: myproject.model.User, at table: sessions, for columns: [org.hibernate.mapping.Column(user)]
  6. 0

    Why I got this error?. "Repeated column in mapping for entity"

    Stack Overflow | 2 years ago | user3133845
    org.hibernate.MappingException: Repeated column in mapping for entity: com.hybernate.chapter2.Customer column: customer_details (should be mapped with insert="false" update="false")

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.MappingException

      Repeated column in mapping for entity: org.jboss.ejb3.test.composite2.Composite column: id2 (should be mapped with insert="false" update="false")

      at org.hibernate.mapping.PersistentClass.checkColumnDuplication()
    2. Hibernate
      Configuration.validate
      1. org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:487)
      2. org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:504)
      3. org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:521)
      4. org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:318)
      5. org.hibernate.mapping.RootClass.validate(RootClass.java:186)
      6. org.hibernate.cfg.Configuration.validate(Configuration.java:815)
      6 frames