views:

255

answers:

1

Hello, I want to compare a column value to the current date, using HQL.

I tried

IQuery someQuery = session.CreateQuery(String.Format(
            @"Select s.Id
            From InventoryProductStateItem s
            where s.ValidFrom < current_date()"));

This throws the exception "Incorrect syntax near keyword current_date()"

current_date does´nt work either.

+1  A: 

It's been a while since I used NHibernate, but I think there's a hql function called "current_timestamp" that the various dialect implementations in NHibernate map to their own sql dialect variant.

Failing that, you could always turn it into a parameter.

Willem van Rumpt
don´t know what this current_date is about
Jan-Frederik Carl