Hi,
I'm new to hibernate and I'm trying to do some basic stuff...
I have countries and partners. Moreover countries have many partners and this association is defined by means of the table partner_in_country.
here is how I mapped the classes:
CountryCode:
<hibernate-mapping>
<class name="ch.orange.rps_ws.domain.Country" table="Country">
<id name="id" column="country_id">
<generator class="native"/>
</id>
<property name="country_fr" column="country_fr"/>
<property name="country_it" column="country_it"/>
<property name="country_de" column="country_de"/>
<property name="country_en" column="country_en"/>
<set name="partners" table="partner_in_country">
<key column="country_id"/>
<many-to-many column="partner_id" class="ch.orange.rps_ws.domain.Partner"/>
</set>
</class>
</hibernate-mapping>
PartnerCode:
<hibernate-mapping>
<class name="ch.orange.rps_ws.domain.Partner" table="Partner">
<id name="id" column="partner_id">
<generator class="assigned"/>
</id>
<property name="official_name" column="official_name"/>
<property name="network_name" column="network_name"/>
<property name="handset_display" column="handset_display"/>
<property name="web_address" column="web_address"/>
<property name="map_url" column="map_url"/>
<property name="map_code_2g" column="map_code_2g"/>
<property name="map_code_3g" column="map_code_3g"/>
<property name="visible" column="visible"/>
<set name="services" table="partner_has_service">
<key column="partner_id"/>
<many-to-many column="service_id" class="ch.orange.rps_ws.domain.Service"/>
</set>
</class>
</hibernate-mapping>
now I'd like to implement a method in the PartnerDAO (or in the CountryDAO) which returns all the partners in one country by using a named query.
How should I do that???? or better.. how should the query look like?