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 735143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:27:17+00:00 2026-05-14T07:27:17+00:00

This really puzzled for hours, I searched all over the internet, but got no

  • 0

This really puzzled for hours, I searched all over the internet, but got no working solution. Can someone point where the problem is … thanks !
I created my own dialect class

public class MySQLDialectExtended : MySQLDialect
{
    public MySQLDialectExtended()
    {
        RegisterFunction("date_add_interval", new SQLFunctionTemplate(NHibernateUtil.Date, "date_add(?1, INTERVAL ?2 ?3)"));            
    }
}

Then I try to use it as follows:

query.Append(
   " ( date_add_interval(D.ApprovalDate, 1, YEAR) < current_timestamp() <  date_add_interval(D.RenewalDate, -1, YEAR) )");

It fails with following exception:

NHibernate.Hql.Ast.ANTLR.QuerySyntaxException : Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. near line 1, column 677

where the column number is at the end of the first ‘YEAR’ word.

Edit:
here is my configuration

    <property name="dialect">MyCompanyName.MySQLDialectExtended, MyCompanyName</property>
    <property name="hbm2ddl.keywords">none</property>
  • 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-05-14T07:27:17+00:00Added an answer on May 14, 2026 at 7:27 am

    Can you post the whole NHibernate query?

    UPDATE: Well, the query is obviously malformed and erroneous:

    Select distinct D from MBIgnition.Core.Domain.Model.Deal D where 1=1 and 
    ( (D.MortgageStatus = 30 ) or 
      (D.MortgageStatus = 35 ) or 
      (D.MortgageStatus = 40 ) or 
      (D.MortgageStatus = 45 ) or 
      (D.MortgageStatus = 55 ) or 
      (D.MortgageStatus = 50 ) ) and 
      // next line is erroneous as the first AND operator does not have a lefthand side operand
    (( and ( date_add_interval(D.ApprovalDate, 1, YEAR) < current_timestamp() < date_add_interval(D.RenewalDate, -1, YEAR) ) ) )
    

    As you can see, there’s an AND operator in your code without any lefthand-side arguments. There should be something wrong with your HQL. Double check it again and if you couldn’t pinpoint the error it will be useful to post the HQL or the criteria building code here.

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

Sidebar

Related Questions

This really, really urks me, so I hope that someone can give me a
This is really strange but this code is working fine unless the value entered
This really has my stumped today. I'm sure its simple, but... Here is my
This sounds really stupid, but I was told that you could drag-and-drop visual components
This is really stumping me today. I'm sure its not that hard, but I
I´m not sure if this is really a programming question, but it's related to
I am really puzzled by this. I believe I am managing memory the correct
okay...im really puzzled with this. I want to create a regular asp.net webforms website
Is this really the easiest way to do this? http://simplesamples.info/MFC/Clipboard.php
I'm just curious about this really, does anyone know why they broke convention on

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.