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

hiberante Many-to-Many: save

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In hiberante Many-to-Many, is it possible like this

In the last step save, it will save object Teacher and each of Students ?

Usually, we need firstly create student and save it, create Teacher and save it. Then set the array to Teacher and update it. It is too many steps. So I am curious if we have some shortcut ?

Thanks.
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
t.setStudents(s);


- Does the List<Students> entry in POJO accompanied by <list> entry in the Student.hbm file? If yes, then add the xml element <list ... cascade="save"/> in the Student.hbm.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic