DEV Community

Danilo Batista de Queiroz
Danilo Batista de Queiroz

Posted on

1

Answer: How to choose DDL Primary Key constraint names with JPA/Hibernate

The class org.hibernate.mapping.PrimaryKey does the following:

public String sqlConstraintString(Dialect dialect) {
    StringBuilder buf = new StringBuilder("primary key (");
    Iterator iter = getColumnIterator();
    while ( iter.hasNext() ) {
        buf.append( ( (Column) iter.next() ).getQuotedName(dialect) );
        if ( iter.hasNext() ) {
            buf.append(", ");
        }
    }
    return buf.append(')').toString();
}

The solution would be to…

Top comments (0)