Hi all:

This is a newbie question, so please bear with me.

I have the following tables (simpify version).

CITY:
city (varchar2) (PK)
province (varchar2) (PK)

CITY_TL:
city (varchar2) (PK)
province (varchar2) (PK)
lang (char (2)) (PK)

LOCATION:
location (varchar2) (PK)
some other column.

As you can see, there are no relationship between CITY and LOCATION.
However, it was set up in a way that CITY.Province can equals to be
LOCATION.Location.  So, I want to execute a query like this:

select c.*
from city c
join city_tl ctl on c.city = ctl.city
join location l on l.location = c.province

How do I do that in NHibernate?  Is this even doable?

Here is my mapping files for CITY and LOCATION

CITY:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="NHDAL"
                   namespace="NHDAL.Domain">

  <class name="CityTL" table="CITY_TL">
    <composite-id>
      <key-property column="CITY" type="String" name="Name"/>
      <key-property column="PROVINCE" type="String" name="Province"/>
      <key-property column="LANG" type="String" name="Lang" />
    </composite-id>

    <timestamp
        column="MODIFY_DATE"
        name="ModifyDate"
        access="property"
        unsaved-value="null"/>

    <property name="ProvinceDescription" column="PROVINCE_TL"
type="String" not-null="true" />
    <property name="Description" column="CITY_TL" type="String" not-
null="true"/>
    <property name="SortOrder" column="SORT_ORDER" type="Int32" not-
null="false"/>

    <many-to-one name="City" class="City">
      <column name="CITY"/>
      <column name="PROVINCE"/>
    </many-to-one>
  </class>

</hibernate-mapping>

LOCATION:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="NHDAL"
                   namespace="NHDAL.Domain">

  <class name="Location" table="LOCATION">
    <id column="LOCATION" name="Name">
      <generator class="assigned" />
    </id>

    <timestamp
        column="MODIFY_DATE"
        name="ModifyDate"
        access="property"
        unsaved-value="null"/>


      </class>

</hibernate-mapping>


Can someone shine some light on this and tell me what should the query
look like in NHibernate?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to