Ayende wrote a very nice article about usage of NHibernate filters.
http://nhforge.org/blogs/nhibernate/archive/2009/05/04/nhibernate-filters.aspx
or
http://ayende.com/Blog/archive/2009/05/04/nhibernate-filters.aspx
i wonder wheather one could use this filter within a bag on a many to
one property:
something like this.
class mapping :
<hibernate-mapping ...>
<class name="Animal" table="animal">
<id name="Id" column="id" type="int"><generator class="native" /
></id>
<property name="somValue"/>
...
<bag name="medicalStatus" table="medicalstatus">
<key column="animal_id"></key>
<one-to-many class="Animal"/>
<filter name="status_at_time" condition=":effdt <=
Reporting.reportingDate" />
</bag>
<joined-subclass name="Eagle">
<key column="bird"/>
...
</joined-subclass>
</class>
<class name="MedicalStatus" table="medicalstatus">
<id name="Id" column="id" type="int"><generator class="native" /
></id>
<property name="diagnosis"/>
...
<many-to-one name="Reporting" column="reporting_id"
class="reportinglog"/>
</class>
<class name="ReportingData" table="reportinglog">
<id name="Id" column="id" type="int"><generator class="native" /
></id>
<property name="reportingDate"/>
...
</class>
</hibernate-mapping>
<filter-def name="effectiveDate">
<filter-param name="status_at_time" type="System.DateTime"/>
</filter-def>
Another idea i had was using a filter to create a many-to-one out of a
bag association, so that the Animal would have only a MedicalStatus-
object for a certain defined time. Maybe with a combination of
ordering the result by date and taking the first that matches the
filter?
Has anyone tried this already or can provide any hint?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---