-->
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: Query member of unreferenced collection
PostPosted: Mon May 31, 2004 11:26 am 
Newbie

Joined: Sat Oct 11, 2003 1:47 pm
Posts: 17
Hibernate Version: 2.1 With Spring 1.0.3 with JBoss 3.2.3, Mysql 4.0.15

I have a table that stores the project information. Projects can belong to project groups, which are basically projects too(they are differentiated by a type column). My mapping for the projectgroups column looks like this
<id name="projectID" column="PROJECT_ID" unsaved-value=-1/>

<set name="groupIDs" table="PROJECT_PROJECTGROUP" lazy="false">
<key column="PROJECT_ID"/>
<element column="PROJECT_GROUP_ID" type="integer"/>
</set>

This creates two tables, PROJECT which contains the id column and otherproject related columns and a PROJECT_PROJECTGROUP table that has two columns, PROJECT_ID and PROJECT_GROUP_ID which are both foreign keys to the PROJECT TAble. For e.g. in PROJECT Table
Project Type Name
1 Group TestGroup1
2 Member TestProject1

and PROJECT_PROJECTGROUP containing
PROJECT_ID PROJECT_GROUP_ID
2 1

This works fine. Now im trying to give the projectgroup id and retrieve the list of projects that belong to this project group.
I tried all combinations but couldnt retrieve this. Im using MySQL 4 so the last attempt at doing something like
"from Project proj where proj in elements(proj.groupIDs)" doesnt work as well.(Due to sub-selects).

What is the best way to do this? I can feed in the project group id and would like thelist of projects that belong to that group.

Thanks so much
Raja


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.