Duplicate index name in generated DDL for @Embeddable types in Hibernate

Solution Verified - Updated -

Issue

  • An @Embeddable type is defined with a column index

    ...
    import org.hibernate.annotations.Index;
    ...
    @Embeddable
    public class Title implements Serializable {
        @Index(name = "title_idx")
        private String theTitle;
        ...
    }
    
  • The @Embeddable type is used in several entities (included via @Embedded)

  • When generating DDL, Hibernate attempts to create a database index with the same name (e.g. 'title_idx') for each entity

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6
  • Hibernate 4

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.