The IDX is in the join table because since its a list hibernate should maintain the order of how items are added to the list
person.getAddresses().add(address1);
person.getAddresses().add(address2);
this would generate some items in the Person_Address join table, and to know that address1 is at index 0 and address2 is at index 1 it needs the IDX so that when you get back the data from the DB the order is preserved.
id_person | id_address | IDX |
0 | id_address1 | 0 |
0 | id_address2 | 1 |
for your real problem i can't help you. i usually write my DDL by hand and then map it to hibernate using annotations, i never generate DDL SQL automatically.