I should have said "instantiate a configuration"... ie. NHibernate.Cfg.Configuration configuration = new NHibernate.Cfg.Configuration();
I'll have to create an independent test case... will take some time... meanwhile here are my mappings/classes...
Here is the Deal xml.....
Code:
<class name="BP.Viper.DataObjects.Deal, BP.Viper.DataObjects" table="Deal">
<jcs-cache usage="read-write"/>
<id name="Dealid" unsaved-value="0" column="DealId" type="long">
<generator class="assigned" >
</generator>
</id>
<property name="Fromdate" column="FromDate" type="date"/>
<property name="Todate" column="ToDate" type="date"/>
<property name="Companyid" column="CompanyId" type="long"/>
<property name="Contractid" column="ContractId" type="long"/>
<property name="Uomid" column="UOMId" type="string"/>
<property name="Currencyid" column="CurrencyId" type="string"/>
<property name="Entityid" column="EntityId" type="long"/>
<property name="Portfolioid" column="PortfolioId" type="string"/>
<property name="Tradedate" column="TradeDate" type="date"/>
<property name="Buysellid" column="BuySellId" type="string"/>
<many-to-one name="Portfolio" column="PortfolioId" class="BP.Viper.DataObjects.Portfolio, BP.Viper.DataObjects" insert="false" update="false"/>
<many-to-one name="Counterparty" column="CompanyId" class="BP.Viper.DataObjects.Counterparty, BP.Viper.DataObjects" insert="false" update="false"/>
<many-to-one name="LegalEntity" column="EntityId" class="BP.Viper.DataObjects.LegalEntity, BP.Viper.DataObjects" insert="false" update="false"/>
<bag name="Volumes" lazy="false" inverse="true" cascade="all">
<key column="Dealid"/>
<one-to-many class="BP.Viper.DataObjects.DealVolume, BP.Viper.DataObjects"/>
</bag>
</class>
Here is the DealVolume xml....
Code:
<class name="BP.Viper.DataObjects.DealVolume, BP.Viper.DataObjects" table="DealVolume">
<jcs-cache usage="read-write"/>
<composite-id>
<key-property name="Dealid" column="DealId" type="long"/>
<key-property name="Point" column="Point" type="string" />
<key-property name="Fromdate" column="FromDate" type="date" />
</composite-id>
<many-to-one name="Deal" column="DealId" class="BP.Viper.DataObjects.Deal,BP.Viper.DataObjects" insert="false" update="false" />
<property name="Todate" column="ToDate" type="date"/>
<property name="Quantity" column="Quantity" type="double"/>
<property name="Uomid" column="UOMId" type="string"/>
</class>
Here is the Deal class....
Code:
public class Deal {
virtual public long Companyid{
get {
return companyid;
}
set {
this.companyid = value;
}
}
virtual public long Contractid{
get {
return contractid;
}
set {
this.contractid = value;
}
}
virtual public string Currencyid{
get {
return currencyid;
}
set {
this.currencyid = value;
}
}
virtual public long Dealid{
get {
return dealid;
}
set {
this.dealid = value;
}
}
virtual public long Entityid{
get {
return entityid;
}
set {
this.entityid = value;
}
}
virtual public System.DateTime Fromdate{
get {
return fromdate;
}
set {
this.fromdate = value;
}
}
virtual public string Portfolioid{
get {
return portfolioid;
}
set {
this.portfolioid = value;
}
}
virtual public System.DateTime Todate{
get {
return todate;
}
set {
this.todate = value;
}
}
virtual public System.DateTime Tradedate{
get {
return tradedate;
}
set {
this.tradedate = value;
}
}
virtual public string Uomid{
get {
return uomid;
}
set {
this.uomid = value;
}
}
virtual public string Buysellid {
get {
return buysellid;
}
set {
this.buysellid = value;
}
}
virtual public Portfolio Portfolio {
get {
return portfolio;
}
set {
this.portfolio = value;
}
}
virtual public Counterparty Counterparty {
get {
return counterparty;
}
set {
this.counterparty = value;
}
}
virtual public LegalEntity LegalEntity {
get {
return legalentity;
}
set {
this.legalentity = value;
}
}
virtual public IList Volumes {
get {
if (volumes==null) {
volumes = new ArrayList();
}
return volumes;
}
set {
this.volumes = value;
}
}
private long companyid;
private long contractid;
private string currencyid;
private long dealid;
private long entityid;
private System.DateTime fromdate;
private string portfolioid;
private System.DateTime todate;
private System.DateTime tradedate;
private string uomid;
private string buysellid;
private Portfolio portfolio;
private Counterparty counterparty;
private LegalEntity legalentity;
private IList volumes;
public Deal(){
}
public Deal(long dealid){
this.dealid = dealid;
}
}
Here is the DealVolume class.....
Code:
public class DealVolume {
virtual public Deal Deal {
get {
return deal;
}
set {
this.deal = value;
}
}
virtual public long Dealid {
get {
return dealid;
}
set {
this.dealid = value;
}
}
virtual public System.DateTime Fromdate {
get {
return fromdate;
}
set {
this.fromdate = value;
}
}
virtual public string Point {
get {
return point;
}
set {
this.point = value;
}
}
virtual public double Quantity {
get {
return quantity;
}
set {
this.quantity = value;
}
}
virtual public System.DateTime Todate {
get {
return todate;
}
set {
this.todate = value;
}
}
virtual public string Uomid {
get {
return uomid;
}
set {
this.uomid = value;
}
}
private long dealid;
private System.DateTime fromdate;
private string point;
private double quantity;
private System.DateTime todate;
private string uomid;
private Deal deal;
public DealVolume() {
}
public DealVolume(long dealid, System.DateTime fromdate, string point) {
this.dealid = dealid;
this.fromdate = fromdate;
this.point = point;
}
public override bool Equals(object obj) {
if (obj == null)
return false;
return ((this.dealid == ((DealVolume)obj).dealid)&&
(this.fromdate.ToShortDateString().Equals(((DealVolume)obj).fromdate.ToShortDateString()))&&
(this.point.Equals(((DealVolume)obj).point)));
}
public override int GetHashCode() {
return base.GetHashCode ();
}
}