Is this check necessary?  The uniqueConstraintSql method is overloaded.  One takes org.hibernate.mapping.UniqueKey and the other org.hibernate.metamodel.relational.UniqueKey.  Here, the else block is unreachable code, I believe.  org.hibernate.metamodel.relational.UniqueKey can return only org.hibernate.metamodel.relational.Columns in the Iterator.