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")

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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; } }
    via by Bill Burke,
  • 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; } }
    via by Bill Burke,
  • Hibernate mapping a map <enum, Integer>
    via Stack Overflow by user2171809
    ,
  • How to solve org.hibernate.MappingException?
    via Stack Overflow by Arne
    ,
    • 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)

    Users with the same issue

    tvrmsmith
    tvrmsmith6 times, last one,
    Pilleo
    Pilleo39 times, last one,
    odd
    odd52 times, last one,
    kjhdofjosvs
    kjhdofjosvs2 times, last one,
    Unknown visitor1 times, last one,
    7 more bugmates