This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with one to many relationship  RSS feed

 
Prem Jain
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am implementing JPA hibernate simple application using one to many relationship.

Relation ship is Comapny (1)----------- Department(*)

Company.java is as follow :



Department.java is as follow :




CompanyDAO.java is follow



HibernateUtil.java




What I am doing is , I am adding new department to existing company. After execution above code

Table created are :
1. Company table with id and name
2. Department table with deptId , deptName , compId.

so at the time adding department , it does not threw any exception but updates records in department as
1(Id),Development(DeptName),null(compId) .

I am not getting why it is not updating compId column. Please help.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!