I have a query that is giving my this error:
NHibernate.PropertyNotFoundException: Could not find a setter for property
'CompanyId' in class 'System.RuntimeType'
I have not been able to find anything that points to where this would come
from. Most references to this online are about misspelled string names of
properties but I am using lambda expressions for everything.
The query is below, note that DailyTransaction is polymorphic and
subclasses can map to other tables or the DailyTransaction table.
private IFutureEnumerable<AccountBalanceSummaryRecord>
AccountBalanceSummary(Product product, ProductCycle productCycle)
{
DailyTransaction transaction = null;
TransactionType transactionType = null;
DailyTransactionProductValue productValue = null;
AccountGroup accountGroup = null;
Account account = null;
AccountBalanceSummaryRecord record = null;
return Session.QueryOver<DailyTransaction>(() => transaction)
.JoinEntityAlias(() => productValue, () => transaction.Id ==
productValue.DailyTransaction.Id)
.JoinAlias(() => transaction.TransactionType, () => transactionType)
.JoinAlias(() => transaction.DebitAccountGroup, () => accountGroup)
.JoinAlias(() => transaction.DebitAccount, () => account)
.Where(t => t.Product.Id == product.Id)
.And(t => t.Day == productCycle.Day)
.And(t => transactionType.Code != TransactionType.A)
.And(t => transactionType.Code != TransactionType.B)
.And(t => productValue.ScheduledCycle.Id == productCycle.Cycle.Id)
.And(t => accountGroup.BusinessRight == BusinessRight.A)
.And(t => accountGroup.IsBalanced)
.And(t => account.AccountType == AccountType.TT)
.SelectList(l => l
.SelectGroup(() => transaction.Company.Id).WithAlias(() => record.CompanyId)
.SelectGroup(() => transaction.DebitAccountGroup.Id).WithAlias(() =>
record.AccountGroupId)
.SelectGroup(() => transaction.DebitLocation.Id).WithAlias(() =>
record.LocationId)
.SelectGroup(() => account.AccountType).WithAlias(() => record.AccountType)
.SelectSum(() => productValue.ScheduledValue).WithAlias(() =>
record.DebitScheduledValue)
.SelectSum(() => transaction.DebitValue).WithAlias(() => record.DebitValue)
)
.TransformUsing(Transformers.AliasToBean<AccountBalanceSummaryRecord>())
.Future<AccountBalanceSummaryRecord>();
}
I am also having an issue where 13 left joins from those polymophic tables
are being added to the query.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nhusers/0487955e-914d-4612-96cb-e8ed6fac2751n%40googlegroups.com.