In addition to the automatically-generated foreign key name change, I found that Hibernate 5 is not honouring the foreign-key attribute specified in '<key>' element, i.e: I have this:
Code:
<set name="roles" lazy="false" table="consumer_roles">
<key column="consumer" foreign-key="FKConsumerRolesConsumer"/>
<many-to-many column="role" class="org.jpos.ee.Role" foreign-key="FKConsumerRolesRole"/>
</set>
In 4.3.11.Final I get:
Code:
alter table consumer_roles
add constraint FKConsumerRolesRole
foreign key (role)
references role;
alter table consumer_roles
add constraint FKConsumerRolesConsumer
foreign key (consumer)
references consumer;
same config with 5.0.2.Final gives:
Code:
alter table consumer_roles add constraint FK48dmxni8c7c85pvwgooneoy92 foreign key (role) references role;
alter table consumer_roles add constraint FKtr3o7se0v5nhgy29tosm9a6ek foreign key (consumer) references consumer;
I'm sure it has to be something wrong on my side, but didn't manage to figure out what just yet.