-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: one to Many relationship cascade or mapping issue.
PostPosted: Mon Mar 10, 2014 9:39 am 
Newbie

Joined: Mon Mar 03, 2014 1:29 pm
Posts: 3
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.