Considering the following two tables:
| User | UserAttribute |
|---------- |-------------------|
| userId(PK)| attributeId(PK) |
| firstName | use
First of all, it should replace MapKeyType(Hibernate) with MapKeyClass(JPA) or just remove it since Hibernate will auto detect.
And MapKeyJoinColumns/MapKeyJoinColumn will be skipped in this case, refer to the JPA document https://docs.oracle.com/javaee/6/api/javax/persistence/MapKeyJoinColumn.html I guess they're used for entity only.
The exception means key UserType's column number is not the same with the key column. I can't find @MapKeyColumns but I tried @MapKeyColumn(name="id") and make AttributeKeyHbm only has "id" and it works. So all is to find the MapKeyColumns-like annotation.