Sunday, 10 June 2012

One to many relationship in hibernate using annotation -2

Today i am going to tell you how to do one to many relationship in hiberantae by creating a intermediate table. Before going through this post first go through the First Post then only you can understand this post. So in the earlier post i expained you how to do one to many relationship without using the intermediate table.
To develop the one to many mapping using intermediate table we have to make few changes in the Student class and course class.

Please make below changes in the student Class-

Here we add one more annotation @JoinTable to make a intermediate table.

For the course class remove the studentId field.

That changes only we have to make.

No comments:

Post a Comment