[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5586) PersistentClass.checkColumnDuplication does not honor @Column.table

Jürgen (JIRA) noreply at atlassian.com
Wed Sep 22 11:38:59 EDT 2010


PersistentClass.checkColumnDuplication does not honor @Column.table
-------------------------------------------------------------------

                 Key: HHH-5586
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5586
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.1
         Environment: hibernate 3.3.1.GA packaged with jboss 5.1.0.GA

            Reporter: Jürgen


similar column names in main and a secondary table triggers MappingException:
org.hibernate.MappingException: Repeated column in mapping for entity
in case of javax.persistence.InheritanceType.TABLE_PER_CLASS

seems to me as if org.hibernate.mapping.PersistentClass.checkColumnDuplication(Set, Iterator) does not consider javax.persistence.Column.table() value for duplication check.

{code}
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.example.AAAX column: col1 (should be mapped with insert="false" update="false")
	at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:670)
	at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:692)
	at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:714)
	at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:468)
	at org.hibernate.mapping.UnionSubclass.validate(UnionSubclass.java:63)
	at org.hibernate.cfg.Configuration.validate(Configuration.java:1135)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1320)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
...
{code}

Following entity model (nevermind the inheritance, it a legacy db mapping)

{code}
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
abstract class A {}

@Entity
@Table(name="AA")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorFormula(value="discriminator")
abstract class AA extends A {
  @Column(name = "col1")
  protected String col1;
}

@Entity
@SecondaryTable(name = "T", pkJoinColumns=@PrimaryKeyJoinColumn(name="a"))
abstract class AAA extends AA {
  @Column(name = "col1", table="T")
  protected String Tcol1;
}

@Entity
@DiscriminatorValue(value="AAX")
public class AAAX extends AAA {
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list