Hello,
I knew nHibernate does not support UNION. But there are some tricks, we can implement the same like :
- Using raw-sql
- Using sub-union class
I have an old application which is using <join table></join table> Now, I want to implement UNION here.
Here are the file(s) in application:
file: .hbm.xml
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="">
<id name="Id" column="ID" type="Int32">
</id>
<!--Some properties are here -->
<property name="" column=""/>
<!--Relations -->
<many-to-one name="" column="" lazy="false"/>
<bag name="" inverse="false" lazy="false" cascade="none">
<key column="ID" />
<one-to-many class="" />
</bag>
<join table="CAIMainDB.dbo.TClaimOnline">
<key column="ID" foreign-key="ID"/>
<property name="" column=""/>
</join>
</class>
</hibernate-mapping>
file: mapper.cs
<!-- Here I need to implement HQL or Raw SQL to achieve UNION -- >
file: Domain class
<!-- This contains the properties to set the aliases or map with columns -- >
public virtual int Id { get; set; }
I appreciate if anyomne suggest me how to implement in the current scenario of my application.