Is there any way to join on a nullable property? Preferably with the
CriteriaAPI but with HQL would help too.
I have a Corporation object and it has 2 Process audit objects,
Inbound and Outbound. I want to get all the Corporation objects that
have a InboundAudit with a certain LineOfBusiness and the
OutboundAudit is null.
public class Corporation
{
public virtual int Id { get; private set; }
public virtual string Name { get; set; }
public virtual string Location { get; set; }
public virtual IList<Branch> Branches { get; set; }
public virtual ProcessAudit InboundAuditId { get; set; }
public virtual ProcessAudit OutboundAuditId { get; set; }
public Corporation()
{
Branches = new List<Branch>();
}
public virtual void AddBranch(Branch branch)
{
branch.Corporation = this;
Branches.Add(branch);
}
}
public class ProcessAudit
{
public virtual int Id { get; private set; }
public virtual string LineOfBusiness { get; set; }
public virtual DateTime StartDate { get; set; }
}
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="TestCorporationNhibernate"
namespace="TestCorporationNhibernate.Entities">
<class name="TestCorporationNhibernate.Entities.Corporation,
TestCorporationNhibernate" table="Corporation">
<id name="Id" column="Id">
<generator class="native" />
</id>
<property name="Name" column="Name"></property>
<property name="Location" column="Location"></property>
<bag name="Branches" cascade="All" lazy="true" inverse="true">
<key column="CorporationId" />
<one-to-many class="Branch"/>
</bag>
<many-to-one name="InboundAuditId" cascade="All"
column="InboundAuditId" outer-join="true" not-null="true"/>
<many-to-one name="OutboundAuditId" cascade="All"
column="OutboundAuditId" outer-join="true" />
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="TestCorporationNhibernate"
namespace="TestCorporationNhibernate.Entities">
<class name="TestCorporationNhibernate.Entities.ProcessAudit,
TestCorporationNhibernate" table="ProcessAudit">
<id name="Id" column="Id">
<generator class="native" />
</id>
<property name="LineOfBusiness" column="LineOfBusiness" />
<property name="StartDate" column="StartDate" />
</class>
</hibernate-mapping>
Any help would be 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]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---