I am still in the learning phase. There are most probably much better
alternatives, but what I am currently using in some kind of
translation of some SQL code into Nhibernate. Unfortunately, I have
little time for studying in greater detail all the various
alternatives.





On Nov 9, 4:35 pm, Fabio Maulo <[email protected]> wrote:
> and perhaps would be even better the usage of a namedquery and put some
> logic in an object instead in the query.
>
> 2009/11/9 Oskar Berggren <[email protected]>
>
>
>
>
>
>
>
> > Formatting that to actually be readable might be a good idea.
>
> > /Oskar
>
> > 2009/11/9 mikeusdev <[email protected]>:
>
> > > Hi,
>
> > > I am getting an error message when I try to execute the following
> > > query:
>
> > > IList query = session.CreateQuery(@"select account.Number,
> > > account.Description, sum(case when (entry.IsDebit = 1m) then case when
> > > (entry.YearId < 6 and accountType.ResetBalanceYearly = 1) then 0m when
> > > (entry.YearId < 6 and accountType.ResetBalanceYearly = 0) then
> > > entry.Amount when (entry.YearId = 6) then entry.Amount end else case
> > > when (entry.YearId < 6 and accountType.ResetBalanceYearly = 1) then 0m
> > > when (entry.YearId < 6 and accountType.ResetBalanceYearly = 0) then
> > > entry.Amount * -1 when (entry.YearId = 6) then entry.Amount * -1 end
> > > end) as entry.Amount from LedgerEntry entry inner join entry.AccountId
> > > account inner join account.AccountTypeId accountType group by
> > > account.Number, account.Description order by account.Number")
> > >                          .List();
>
> > > The error message is the following:
>
> > > '(' expected after HQL function in SELECT [select account.Number,
> > > account.Description, sum(case when (entry.IsDebit = 1m) then case when
> > > (entry.YearId < 6 and accountType.ResetBalanceYearly = 1) then 0m when
> > > (entry.YearId < 6 and accountType.ResetBalanceYearly = 0) then
> > > entry.Amount when (entry.YearId = 6) then entry.Amount end else case
> > > when (entry.YearId < 6 and accountType.ResetBalanceYearly = 1) then 0m
> > > when (entry.YearId < 6 and accountType.ResetBalanceYearly = 0) then
> > > entry.Amount * -1 when (entry.YearId = 6) then entry.Amount * -1 end
> > > end) as entry.Amount from Oberon.Model.BusinessModel.LedgerEntry entry
> > > inner join entry.AccountId account inner join account.AccountTypeId
> > > accountType group by account.Number, account.Description order by
> > > account.Number]
>
> > > Does anyone know what the problem is? I tried various combinations
> > > (column aliases, for example), but I cannot see where the problem
> > > lies.
>
> > > Thanks.
> > > Mike
>
> --
> Fabio Maulo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to