• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot save relations

 
Alejandro Barrero
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working with JPA and Hibernate in MyEclipse 7.0. I generated the entities and DAOS and everything is working correctly in a struts application. Now I am running a test program to create children objects (Booking) related to a parent (Hotel). The source code is:

The code is creating the children but the foreign keys in the table remain null. I do not know what i am doing wrong.

Your help will be greatly appreciated,

Alejandro Barrero
 
Alejandro Barrero
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the answer. I have to set the hotel (parent) in the booking (child): b.setHotel(h);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic