Hello, I have a class called LoanApplication, and it has a collection property set up called Workflow. In the mapping file, I am setting the order of retrieval of the Workflow records to sort by Date, so the current workflow is always the first item in the list.
Now I want to query by the current workflow to get LoanApplications that are in a specific workflow step using the Criteria API. I'm not really sure how to do this. Here is how I am mapping the Workflow collection:
<bag name="ApplicationWorkflow" table="PreApplication.ApplicationWorkflow" generic="true" inverse="true" order-by="StartDate DESC"
cascade="all" lazy="true">
<key column="ApplicationID" />
<one-to-many class="ApplicationWorkflow" />
</bag>
Here is how I am retrieving applications (this is where I need to add the filter by Current Workflow functionality):
public IList<Model.PreApplication.Application> GetCompletedApplications()
{
IList<Model.PreApplication.Application> result = null;
using (ITransaction transaction = this.Session.BeginTransaction())
{
result = this.Session.CreateCriteria<Model.PreApplication.Application>()
.AddOrder(new Order("EnteredDate", false))
.List<Model.PreApplication.Application>();
transaction.Commit();
}
return result;
}
Thanks for any help!