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: Many to many relation
PostPosted: Mon Sep 24, 2007 10:06 am 
Newbie

Joined: Sun Nov 05, 2006 10:19 am
Posts: 13
Hello,

I have a many - to - many relation.

Users
Roles
Users2Roles.

For this relation I have 1 bag defined in Users.hbm.xml.

Code:
<bag name="Roles" table="
Users2Roles" inverse="true" lazy="true" cascade="none">
      <key column="userId" />
      <many-to-many class="Role, namespace">
        <column name="roleId" not-null="true"/>
      </many-to-many>
    </bag>


My question is which is the right way of deleting a role from the user role list.

If I'm setting inverse = false and then user.Roles.Remove(roleToDelete) NH makes a delete all and then insert.

I want to make a delete operation without mapping the Users2Roles table.

Is there any way to do that?

Thank you!


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.