Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

hiberante Many-to-Many: save  RSS feed

 
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: 662
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
Boost this thread!