I have three pojo class Theme { private Integer themeId; ..... private Set<ThemeSectorMap> themeSectors; } class Sector{ private Integer sectorId; private Set<ThemeSectorMap> sectorThemes; } class ThemeSectorMap{ private Integer themeSectorMapId private Theme theme; private Sector sector; private User creator; private Date creationDate; ..... }
In Mapping file of Theme I mapped the Set<ThemeSectorMap> as: <set name="themeSector" table="theme_sector_map" cascade="all" lazy ="true" > <key> <column name="theme_id" /> </key> <one-to-many class="com.ogs.model.ThemeSectorMap" /> </set>
When I add theme object, it insert theme and its mapping also when it provide. But when I update theme and remove any object from set of themeSectors, it set null theme_id (reference column) in corresponding record. I want remove whole mapping record from database.
Please give suggestions.
|