I was wondering if anyone was trying to do this at NHibernate.
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) is another column.
As you can see, there is no connection between CITY and LOCATION. However, it was configured in such a way that CITY.Province can equal LOCATION.Location. So, I can execute a query like this:
select c. * from the city c join city_tl ctl to c.city = ctl.city specify the location l to l.location = c.province
How do I do this at NHibernate? Is it even doable?
Here are 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>
- ,
NHibernate?