Confirmed as a JetDriver bug. I'll try to fix it and open an issue in
NHContrib.

On May 25, 9:34 am, Hadi Eskandari <[email protected]> wrote:
> Any reason this generates a wrong SELECT statement? I'm using a build
> from trunk and Jet driver.
>
> When I run the following :
>
>             using (UnitOfWork.Start())
>             {
>                 var repository = new NHRepository<Account>();
>                 var orders = new[] { new Order("Firstname", true), new
> Order("Lastname", true) };
>                 return repository.FindAll(orders).ToList();
>             }
>
> it fails and generated select statement has no "FROM" keyword, it
> looks like this (notice there is no "FROM")
>
> SELECT this_.AccountId as AccountId25_0_, this_.CurrentBalance as
> CurrentB2_25_0_, this_.Firstname as Firstname25_0_, this_.Lastname as
> Lastname25_0_, this_.Picture as Picture25_0_, this_.RegistrationDate
> as Registra6_25_0_ `Account` this_ ORDER BY this_.Firstname asc,
> this_.Lastname asc
>
> and the exception message is:
>
> System.Data.OleDb.OleDbException: The SELECT statement includes a
> reserved word or an argument name that is misspelled or missing, or
> the punctuation is incorrect.
>
> but when I add a criteria it works without any problem:
>
>         public IList<Account> GetAllAccounts()
>         {
>             using (UnitOfWork.Start())
>             {
>                 var repository = new NHRepository<Account>();
>                 var orders = new[] { new Order("Firstname", true), new
> Order("Lastname", true) };
>                 var criteria = Restrictions.Eq("CurrentBalance", (long)
> 0);
>                 return repository.FindAll(orders, criteria).ToList();
>             }
>         }
--~--~---------~--~----~------------~-------~--~----~
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