Hi, I'm still struggling with a many-to-many example that I'm creating, but seeing what I've done so far may be helpful to you. My .java and .hbm.xml files were auto-created using HibernateTools (with a few tweaks) and contain files for the middle table. While I don't know Hibernate very well, I assume that HibernateTools knows what it is doing, so I assume that this code is correct. (?)
You can find the entire zipped project here: http://www.brightworks.com/technology/tech_questions/hibernate_lazy_associations/Bw_005.zip And here's the thread on the problems I'm having with it: http://tech.groups.yahoo.com/group/flexcoders/message/58833 Also, this blog post by Victor Rubba may be helpful: http://viconflex.blogspot.com/2006/12/many-to-many-using-fds-hibernate.html Finally, my "Flex with Java" page might be of some interest: http://www.brightworks.com/technology/adobe_flex/with_java.html Good luck! When you find a solution, please consider blogging about it. :-) Douglas ------------------------------------------------- Douglas McCarroll CairngormDocs.org Webmaster http://www.CairngormDocs.org Flex Developer http://www.brightworks.com 617.459.3840 ------------------------------------------------- michalzak81 wrote: > > At this point, I have hibernate working with a many-to-many relationship > Here is what I have > > User Table <- one-to-many -> user_roles Table <- many-to-one -> roles > table > > The retrieval of the records works fine. I can also modify and insert > the records with no hassle. > > But my problems come when I need to insert a relationship ( a record > into the user_roles table ). The Hibernate generated code only has > classes for the other 2 tables, it manages the middle table on its own. > > Could someone please point me into the right direction as to how that > should be done. > >

