-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to delete a many-to-many link table?
PostPosted: Tue Jun 01, 2004 3:09 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 8:53 pm
Posts: 34
Hi,

I have a two classes such as Student/Department which have many-to-many association with each other, there is a link table created out of this association "student_dept".

Code:
Class Department   {
...
private Set students;
....
}

Class Student  {
...
private Set depts;
....
}

Now, if I want to delete entries related to a
particular Department using HQL, can I do the following:

"delete from Department.students ......"

or
//define values and types
.....
String hql = "select dept.students from Department as dept .....";
session.delete(hql, values, types);

I am wondering if the above cases hold true? Otherwise how can I achieve this?

thanks,



Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 5:58 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
No this is not a relational qlery language.
And HQL is a query language, not an actionlanguage.

load dept , remove sutdents from the set and flush. like in pure OO style

_________________
Emmanuel


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

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.