Hello again,
I'm sure that would work if I had an associacio class. However I would lik to do it without another class which is in fact some additional class that does not fit my design...
I have following mappings:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Pix.Data.Category, Pix.Data" table="CATEGORY">
<id name="Id" column="ID" unsaved-value="0" access="field">
<generator class="hilo">
<param name="table">HILO</param>
<param name="column">CATEGORY</param>
<param name="max_lo">100</param>
</generator>
</id>
<property name="Name" column="CATEGORY_NAME" type="String(50)" access="field"/>
<set name="Files" table="FILE_CATEGORY" lazy="true" inverse="true"
access="field">
<key column="CATEGORY_ID"/>
<many-to-many class="Pix.Data.FileBase, Pix.Data" column="FILE_ID"/>
</set>
</class>
</hibernate-mapping>
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Pix.Data.FileBase, Pix.Data" table="FILE_BASE">
<id name="Id" column="ID" unsaved-value="0" access="field">
<generator class="hilo">
<param name="table">HILO</param>
<param name="column">FILE_BASE</param>
<param name="max_lo">100</param>
</generator>
</id>
<property name="Name" column="FILE_NAME" type="String(200)" access="field"/>
<property name="OriginalPath" column="ORIGINAL_PATH" type="String(300)"
access="field"/>
<set name="Categories" table="FILE_CATEGORY" lazy="true" access="field">
<key column="FILE_ID"/>
<many-to-many class="Pix.Data.Category, Pix.Data" column="CATEGORY_ID"/>
</set>
</class>
</hibernate-mapping>
These map C# classes to category and file tables in database. What I really want is to have a possibility to ask for a list of all files balonging to categories let's say A _and_ B, or A _or_ B and so on.
But w/o association in C# since there is already perfect one in mappings and database...