Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7827761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:01:58+00:00 2026-06-02T10:01:58+00:00

Trying HQL, total NHibernate n00b. public IEnumerable<Log> GetLast(int numRecords, string severity) { var query

  • 0

Trying HQL, total NHibernate n00b.

public IEnumerable<Log> GetLast(int numRecords, string severity)
{
    var query = _Session.CreateQuery(
        "from Log as l inner join fetch l.UserProfile order by l.TimeStamp desc where l.Severity in (:severities)")
        .SetParameterList("severities", Translator.SeverityOrHigher(severity))
        .SetMaxResults(numRecords)
        .Enumerable<Log>();

    return query;
}

Translator.SeverityOrHigher returns an IList<string>.

I have a Log object which references a UserProfiles object in many-to-one fashion. The objects are persisted in the database as Logs and UserProfiles, respectively.

I am getting the following exception thrown on the var query = ... line:

Exception of type 'Antlr.Runtime.MismatchedTokenException' was thrown.

I have no idea what that even means, and a Google search wasn’t especially helpful. I don’t know if there’s a problem with the HQL, or the way I set this up. Any guidance would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T10:02:01+00:00Added an answer on June 2, 2026 at 10:02 am

    I haven’t used NHib for ages… have you tried to put the order by statement at the end? Probably it’s working like this, by I always put at the end.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to code the following HQL query using the Criteria API: var userList
I'm trying to write an HQL query which will calculate an average rating for
I am trying to write an hql query which gives me the number of
I am trying to create an HQL query that will filter a tree based
I am trying to write a HQL Query which selectes rows from a table
I'm trying to make a query in HQL that see if the id of
I'm trying to build a query using HQL and OUTER JOIN s and just
I'm trying to write a HQL/Criteria/Native SQL query that will return all Employees that
Trying to do a bit more complex query, and thought that HQL would be
I'm trying to group table values by date, and this HQL query works fine:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.