i'm doing many to many in hibernate for a relation of Student and Address
1 student will have permanent address,temporary address like wise any number of student can stay in one address
student.hbm.xml
address.hbm.xml
Student.java
Address.java
Exception
Exception in
thread "main" org.hibernate.MappingException: Foreign key (FK250691B08CBB085E:STUDENT_ADDRESS [ADDRESS_ID])) must have same number of columns as the referenced primary key (STUDENT_ADDRESS [STUDENT_ID,ADDRESS_ID])
at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90)
at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73)
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1263)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1170)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
at com.demo.Demo.main(Demo.java:26)