• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Many to Many relationship

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have a many to many relationship which returns a collection of refences to local interfaces as defined below :

<ejb-relation >
<ejb-relation-name>features_geographic_zones</ejb-relation-name>

<ejb-relationship-role >
<ejb-relationship-role-name>feature-has-geographic_zones</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source >
<ejb-name>Feature</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>geographicZones</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>

<ejb-relationship-role >
<ejb-relationship-role-name>geographic_zone-has-features</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source >
<ejb-name>GeographicZone</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>features</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>

</ejb-relation>

how does the container persist the relationship/ mapping between the two ( in a one to many the relationship is persisted by creating a foreign key column in the schema). Also how do you traverse the relationship from either side using EJB-QL. A straight forward EJB-QL such as

SELECT OBJECT(g)
FROM GeographicZoneSchema g, IN(g.features) f
WHERE f.uid = ?1

seems to produce a empty collection.

Any thoughts would help.

Thanks

Peter
 
We don't have time for this. We've gotta save the moon! Or check this out:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic