[hibernate-issues] [Hibernate-JIRA] Created: (HCANN-34) @Index Columns in @MappedSuperClasses don't work

Mathias Reem (JIRA) noreply at atlassian.com
Sat Feb 12 05:09:05 EST 2011


@Index Columns in @MappedSuperClasses don't work
------------------------------------------------

                 Key: HCANN-34
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HCANN-34
             Project: Hibernate Commons Annotations
          Issue Type: Bug
    Affects Versions: 3.2.0
         Environment: hibernate-commons-annotations-3.2.0.jar
hibernate-core-3.6.0.jar
postgres
java 1.6
            Reporter: Mathias Reem


Indices in MappedSuperclass are not created in each child Entity, but only in one of them, as index names are global (at least in postgres), for the other Entites I get errors:

10:00:17 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate]: Unsuccessful: create index hash on B (hash)
10:00:17 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate]: ERROR: relation "hash" already exists


{code:title=Root.java|borderStyle=solid}
@MappedSuperclass
abstract class Root {
  @Column(nullable = false, unique = true)
  @Index(name = "hash")
  private String hash;
	
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;

  // Getter, Setter, ...
}
{code}

{code:title=A.java|borderStyle=solid}
@Entity
public class A extends Root {
  // Getter, Setter, ...
}
{code}

{code:title=B.java|borderStyle=solid}
@Entity
public class B extends Root {
  // Getter, Setter, ...
}
{code}

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