DavyBrion wrote:
Code:
IList list = session.CreateQuery("select distinct t2.Table1 from Table2 t2").List();
Thanks for the replay, but would this give me a IList of all the ID's and not the Table1 objects?
Config files:
[Table1]
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly=".." namespace="..">
<class name="Person" table="Person">
<id name="ID" column="ID" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<property column="UserID" type="String" name="UserID" length="255" />
<property column="Associate_No" type="String" name="Associate_No" length="35" />
<property column="Name" type="String" name="Name" not-null="true" length="255" />
<property column="Password" type="String" name="Password" length="255" />
<property column="OldPassword" type="String" name="OldPassword" length="4000" />
<property column="BusSysLogon" type="String" name="BusSysLogon" length="50" />
<property column="Comments" type="String" name="Comments" length="1073741823" />
<property column="SouthUser" type="Boolean" name="SouthUser" not-null="true" />
<property column="UpdatedBy" type="String" name="UpdatedBy" not-null="true" length="255" />
<property column="UpdatedOn" type="DateTime" name="UpdatedOn" not-null="true" />
</class>
</hibernate-mapping>
[Table2 linkes on PersonID to Table1.ID]
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly=".." namespace="..">
<class name="Asset" table="Asset">
<id name="ID" column="ID" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<many-to-one name="Personid" column="PersonID" class="Person" />
<property column="AssetNum" type="String" name="AssetNum" length="255" />
<property column="SerialNum" type="String" name="SerialNum" length="255" />
<property column="Price" type="Decimal" name="Price" />
<property column="Comments" type="String" name="Comments" length="1073741823" />
<property column="UpdatedBy" type="String" name="UpdatedBy" not-null="true" length="255" />
<property column="UpdatedOn" type="DateTime" name="UpdatedOn" not-null="true" />
<property column="PCName" type="String" name="PCName" length="50" />
<many-to-one name="Cpu" column="CPU" class="Assetcpu" />
<many-to-one name="Ram" column="Ram" class="AssetMem" />
<many-to-one name="HdSize" column="HDSize" class="AssethdSize" />
<many-to-one name="AssetList" column="AssetList" class="AssetList" />
<property column="WarExpDate" type="DateTime" name="WarExpDate" />
</class>
</hibernate-mapping>