I am trying to insert data to the DB using hibernate . Here is how I going perform that action
session.beginTransaction();
pojo.StuDetails stu = new
In your SubjectHasStuDetials.hbm.xml
make these changes :
Add cascade="all"
attribute to both stuDetails
and subject
many-to-one tags.
cascade = “all”
then changes at parent class object will
be effected to child class object too, if we write cascade = “all”
then all operations like insert, delete, update at parent object will
be effected to child object also.