By: Kingshore Naidu

Thanks for replay,

After some time i done like bellow,...

public boolean update(int id, Student student, Address address) {

boolean result = false;

try{

Session session = HibernateUtil.getSessionFactory().openSession();

session.beginTransaction();

address.setId(id);

student.setAddress(address);

student.setId(id);

session.update(student);

result = true;

session.getTransaction().commit();

session.close();

}catch(Exception e){

}
return result;
}

Can you help out for bellow code.(save record)

public int saveStudent(Student student, Address address) {

session = HibernateUtil.getSessionFactory().openSession();

session.beginTransaction();

session.persist(student);

address.setId(student.getId());

student.setAddress(address);

int i = (Integer) session.save(student);

session.getTransaction().commit();

session.close();

return i;

}