Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with one to many relationship

 
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