• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in running one to many relation - Hibernate

 
kalle suresh
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am facing the following issue while running one to many relationship.

Basically my code includes,
1. COURSE table and STUDENT table.
2. COURSE will be the master table containing different course names having CNO as Course Number as primary key.
3. STUDENT table contains SNO, SNAME and CNO as Student Number, Student Name and Course Number under which student is under going.
4. Following is the piece of Code.

StudentOneToMany POJO



Course POJO



Student.hbm.xml


Course.hbm.xml


hibernate.cfg.xml


Please note these two tables are not present under database
Below is the Main Program



I am getting the following exception, tables are being created, but data is not getting inserted into the tables. please help me out


 
Charan kumar sarvepalli
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think it is taking wrong package name "Ledu.model.StudentOneToMany".

relook in to the hbm files where it gone mistake.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charan kumar sarvepalli wrote:i think it is taking wrong package name "Ledu.model.StudentOneToMany".

Isn't that just standard Java notation indicating an array of a class?
 
Charan kumar sarvepalli
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes you are right newton
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic