Bi-directional mapping problems while creating tables on runtime
nagaraj kris
Greenhorn
Joined: Jan 12, 2007
Posts: 5
posted
0
Hi,
I have tables with many-many relationship mapping and they are bidirectional.
I am writing junits using spring mock,DBUnit and HSQL. All the tables are created on the fly using hibernate's HBM2DDL option.
when table 'student' is getting created, i am getting exception saying table 'student_course' doesnt exist. I tried to move around the order of tables creation , but nothing is working.
Nag, next time please use the CODE button below the Add Reply button when posting code or XML so that the indentation remains and it is readable.
But I don't see a ManyToMany mapping in your student class. You would have one if you mean to make it bi-directional.
Also, your studentcourse table does not need a mapping. It is a join table, so if you just have the two many to many mappings in just student and course you will generate a join table automatically.