I think you should not use many-to-many because you have a property in the
middle table... so map the middle as an Entity...

  <class name="TableA">
    <id name="ID">
      <generator class="hilo">
      </generator>
    </id>
<property name="Name"/>
<set name="TableATableB" inverse="false">
<key column="TableAID "/>
<one-to-many class="TableATableB" />
</set>
  </class>

  <class name="TableB">
    <id name="ID">
      <generator class="hilo">
      </generator>
    </id>
    <property name="Name"/>
  </class>

  <class name="TableBType">
    <id name="ID">
      <generator class="hilo">
      </generator>
    </id>
    <property name="Name"/>
  </class>

  <class name="TableATableB">
    <composite-id>
  <key-many-to-one name="TableA" />
  <key-many-to-one name="TableB" />
  <key-many-to-one name="TableBType" />
    </composite-id>
  </class>



2010/8/3 thecodefool <[email protected]>

> Hi my question, I hope is a simple one
>
> I have four tables
>
> TableA
>  TableAId
>  Name
>
> TableB
>  TableBId
>  Name
>
> TableBType
>  TableBTypeId
>  Name
>
>
> TableA_TableB
>  TableAId
>  TableBId
>  TableBTypeId
>
> I have normal classes for each nothing fancy, but I do not have a
> class TableA_TableB (Not sure what to do)
>
> I would like to create the following using an ICriteria but I cannot
> for the life of me figure it out.
>
>
> SELECT a.* FROM TableA a
> INNER JOIN TableA_TableB ab ON a.TableAId = ab.TableAId
> WHERE ab.TableBTypeId IN(1,2,3)
>
> Any help is greatly appreciated
>
> Thanks
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
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