Hello, i have the following problem. i have a table "projects" and a table "managers" with a i think called "1:N" relationship. My mapping file (partly): <hibernate-mapping> <class name="....Project" table="Project"> <set name="managers" inverse="true" cascade="all"> <key> <column name="Projectid" not-null="true" /> </key> <one-to-many class=".....Manager" /> </set> </class> </hibernate-mapping> Now i want to delete all my managers concerning one special project and add the new manager. So I do the following: Manager manager; ProjectDAO dao = new ProjectDAO(); Project project = (Project) dao.getSession().get(Project.class, projectID); Set managers = project.getManagers(); managers.clear(); manager = new Manager(); manager.setEmployee(employee_manager); manager.setFunction(managerFunction); manager.setProject(project); dao.getSession().save(manager); managers.add(manager); project.setManagers(managers); dao.save(project); But the thing is that only the new manager was added. The other database entries were not deleted. I thought, if i update the parent entry (project) the child entrys will be deleted automatically (project.getManagers.clear()). Where is my problem? Can anybody help? Thank you very much!!! Greetings from Berlin! Ingo |
begin:vcard fn:Ingo Villnow n:Villnow;Ingo org:University of Applied Sciences Berlin;Applied Computer Sciences adr:;;Treskowalle 8;Berlin;Berlin;10318;Deutschland email;internet:[EMAIL PROTECTED] title:Student der FHTW Berlin tel;work:+49 30 267 42675 tel;home:+49 30 497 87 432 tel;cell:+49 176 23 37 59 49 x-mozilla-html:TRUE url:http://www.fhtw-berlin.de version:2.1 end:vcard
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel