There seems to be an issue with the code in org.hibernate.cfg.JDBCBinder class method bindOneToMany.
Inside the if(manyToMany) block of the method, make following change to generate the mapping correctly.
// element.addColumn( fk.getColumn( 0 ) ); <<-- existing code // added code Iterator fkIterator = fk.getColumnIterator(); while( fkIterator.hasNext()){ element.addColumn((Column)fkIterator.next()); }
There seems to be an issue with the code in org.hibernate.cfg.JDBCBinder class method bindOneToMany.
Inside the if(manyToMany) block of the method, make following change to generate the mapping correctly.
// element.addColumn( fk.getColumn( 0 ) ); <<-- existing code
// added code
Iterator fkIterator = fk.getColumnIterator();
while( fkIterator.hasNext()){ element.addColumn((Column)fkIterator.next()); }