Hi,
I have a domain model like this:
Program--|>ManagerAssignment--|>Assignment<--Portfolio
Code:
<class name="Assignment">
<id name="_id" access="field">
<column name="ID" sql-type="int" not-null="true" />
<generator class="identity" />
</id>
...
</class>
<joined-subclass name="ManagerAssignment" extends="Assignment">
<key column="AssignmentID" />
...
</joined-subclass>
<joined-subclass name="Program" extends="ManagerAssignment">
<key column="AssignmentID" />
...
</joined-subclass>
<class name="Portfolio">
<id name="_id" access="field">
<column name="ID" sql-type="int" not-null="true" />
<generator class="identity" />
</id>
<many-to-one name="Assignment" column="AssignmentID" />
<property name="EffectiveDate" />
...
</class>
I want to get the portfolio for a program on a specific date:
Code:
from Portfolio where Assignment = :program and EffectiveDate = :effectiveDate
This generates the following SQL:
Code:
select
portfolio0_.ID as ID3_,
portfolio0_.AssignmentID as Assignme2_3_,
portfolio0_.EffectiveDate as Effectiv3_3_
from
Portfolio portfolio0_
where
(0=@p0 )
and(EffectiveDate=@p1 );
where @p0 is something like 1234, the AssignmentID for the program I want a portfolio for. I am confused by the
Code:
(0=@p0)
part.
I stepped through the NHibernate source code and saw where, in JoinedSublcassPersister, it refers to this 0 as the discriminator. I thought discriminators were only for single table inheritence?
Of course the above SQL query returns no results.
Any advice or help much appreciated. Thanks!