I have a set of tables, with a .hbm.xml for each.
I tried to put in a named query but it would not compile. I moved the code to a CreateQuery and get.
DB_Portfolio is not mapped [select sum(p.Shares * s.Price) from DB_Portfolio p, DB_Securities s where p.AccountNumber = :accountNumber and p.CUSIP = s.Cusip]
The CreateQuery statement looks like.
IQuery queryBack = session.CreateQuery("select sum(p.Shares * s.Price) from DB_Portfolio p, DB_Securities s where p.AccountNumber = :accountNumber and p.CUSIP = s.Cusip");
queryBack.SetString("accountNumber", accountNumber);
return queryBack.UniqueResult<Decimal>();
I have in the DB_Portfolio .hbm.xml
<many-to-one name="Security" class="BDM_Controller.Source.ORM.DB_Securities, BDM_Controller" column="Cusip"/>
with a foreign key in Portofoio with security on Cusip.
What am I missing here?
Visual Studio 2008, NHibernate 2.1.0.4000, MS SqlServer 2005
Thanks,
---John Putnam