-->
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.  [ 4 posts ] 
Author Message
 Post subject: Filtering in a set
PostPosted: Mon Mar 19, 2007 8:41 am 
Newbie

Joined: Mon Feb 19, 2007 1:16 pm
Posts: 6
Hi:

I would like some help about filtering in a set.

########################################################################
<class name="Grupo" table="GRUP">
<id name="id" type="long" column="GRUP_NU_INTERN">
<generator class="assigned"/>
</id>
...
<set name="puertos" table="ELGR">
<key column="GRUP_NU_INTERN"/>
<many-to-many column="ELGR_CO_ELEMEN_DE" class="Puerto"/>
<!-- HELP: ???Select only those with ELGR.TEPL_CO_TIEMPL = 'A' o 'B'??? -->
</set>
</class>
########################################################################
<class name="Puerto" table="ELEQ">
<id name="id" type="long" column="ELEQ_CO_INTERN">
<generator class="assigned"/>
</id>
...
<set name="grupos" table="ELGR">
<key column="ELGR_CO_ELEMEN_DE"/>
<many-to-many column="GRUP_NU_INTERN" class="Grupo"/>
</set>
</class>
########################################################################

GRUP (Grupo)
-------------------
GRUP_NU_INTERN (PK)

ELEQ (Puerto)
-------------------
ELEQ_CO_INTERN (PK)

ELGR (Grupo-Puerto)
-------------------
GRUP_NU_INTERN (PK)
TEPL_CO_TIEMPL (PK)
ELGR_CO_ELEMENT_DE (PK)

####################################

For a "group" I need "ports" with ELGR.TEPL_CO_TIEMPL = 'A' o 'B'


Thanks,

David G.


Top
 Profile  
 
 Post subject: Many-to-many with additional fields in join table?
PostPosted: Mon Mar 19, 2007 9:48 am 
Regular
Regular

Joined: Wed Aug 24, 2005 11:49 am
Posts: 63
It looks like you want additional information in your join table.
This is not possible with a many-many.

You can create a normal 'one-to-many' to the join table ad a 'many-to-one' from the join table to 'port' (if I understand the domain correctly).
Maybe you can use the 'where' attribute of the set to filter the 'A'/'B' stuff

_________________
Edwin van der Elst
Finalist IT Group


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 19, 2007 1:20 pm 
Newbie

Joined: Mon Feb 19, 2007 1:16 pm
Posts: 6
Thanks, I'll try

David G.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 21, 2007 11:30 am 
Newbie

Joined: Mon Feb 19, 2007 1:16 pm
Posts: 6
I worked with:

<set name="..." table="..." where="...">
<key column="..."/>
<one-to-many class="..."/>
</set>

David G.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.