I am trying call a db-function from HQL. The HQL statement should just call the function and return its value, like this
select someFunction(:someParameter)
If i try to call select current_timestamp()
it fails with
NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.MismatchedTreeNodeException' was thrown. near line 1, column 24 [select current_timestamp()]
I know that there is not much reason for retrieving the current timestamp. But a have created a few user-defined db-function that i would like to unit-test by calling them from HQL.
It seems to me that it's not possible to write a HQL statement without a FROM and WHERE clause. Can this be true?
IQuery query = unitOfWork.Session.CreateQuery("select current_timestamp()");
var ts = query.UniqueResult();