I believe below outlines what I'm trying to do basically. A party will only every be mapped to either an allocation or to a rptside. Never both.
I left out fields/properties which weren't relevant.
Thank you for the help!
table Allocation (
id number,
party_id number
)
table RptSide (
id number,
party_id number
)
table Party (
id number,
parent_id number
)
[Class(Table="tc_alloc")]
public class Allocations
{
decimal _id;
ISet<Party> _Party = new HashSet<Party>();
[Id(1, Column="id", Type="Decimal")]
[Generator(2, Class="sequence")]
[Param(3, Content="tc_party_parent_seq", Name="sequence)]
virtual public decimal Id
{
....
}
[Set(1, Inverse=true, Cascade="save-update")]
[Key(2, ForeignKey="parent_id", Column="id")]
[OneToMany( 3, Class="ClearingReportDAO.Domain.Party, ClearingReportDAO")]
virtual public ISet<Party> Party
{
...
}
.
.
.
}
The other table (RptSide) is exactly the same.
[Class(Table="tc_party")]
public class Party
{
decimal _id;
RptSide _RptSide;
Allocation _Allc;
[Id(1, Column="id", Type="Decimal")]
[Generator(2, Class="sequence")]
[Param(3, Content="tc_party_parent_seq", Name="sequence)]
virtual public decimal Id
{
....
}
[ManyToOne(1, ForeignKey = "id", Column="parent_id", Class="ClearingReportDAO.Domain.RptSide, ClearingReportDAO, Cascade="save-update")]
virtual public RptSide RptSide
{
...
}
[ManyToOne(1, ForeignKey = "id", Column="parent_id", Class="ClearingReportDAO.Domain.Allocation, ClearingReportDAO, Cascade="save-update")]
virtual public Allocation Allocation
{
...
}
}
|