The moose likes Object Relational Mapping and the fly likes hiberante Many-to-Many: save Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "hiberante Many-to-Many: save" Watch "hiberante Many-to-Many: save" New topic
Author

hiberante Many-to-Many: save

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 756
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

Joined: May 16, 2005
Posts: 504

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.


If you are not laughing at yourself, then you just didn't get the joke.
 
 
subject: hiberante Many-to-Many: save
 
Threads others viewed
Passing Objects Created By User to Array in Different Class
elt column hibernate
[Hibernate] One-to-many batch updating?
Arraylist and for enchanced loop question
NonUniqueObjectException
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com