I have below classes. How can I write mapping document for MainBranch.Id column. I have no branch table in database, just want to use branchId for MAINBRANCHCODE. Any Idea?
public class Bundle
{
public virtual Decimal Id { get; set; }
public virtual BundleEntranceInformation Information { get; set; }
}
public class BundleEntranceInformation
{
public virtual Branch MainBranch { get; set; }
}
public class Branch
{
public virtual short Id { get; set; }
}
My mapping document:
<class name="PromissoryNotes.Server.Data.Bundle, PromissoryNotes.Server.Data" table="BUNDLE" lazy="true">
<id name="Id" column="ID" type="Decimal">
<generator class="increment" />
</id>
<property name="Information.MainBranch.Id" column="MAINBRANCHCODE" type="short"></property>
</class>
can be mapped as:
So the plus sign is key (I believe that java-hibernate uses the dollar sign $ for this)
Use a component mapping
Here is the answer :)