-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Problem calling Query using a function ...
PostPosted: Thu May 06, 2010 8:16 pm 
Newbie

Joined: Wed Jul 26, 2006 4:18 pm
Posts: 8
Location: Brussels, Belgium
I have a function that calculates the distance between 2 strings.
Doing so with various fields, I can calculate whether 2 users are the same/similar or not, by doing this in the "MS SQL Server Management Studio" (see discussion here).

Code:
with Search_distances as (
select   
   dbo.LEVENSHTEIN (USEARCH.logonuid, :logonuid) distance_logonuid,
   dbo.LEVENSHTEIN (USEARCH.firstname, :firstname) distance_first,
   dbo.LEVENSHTEIN (USEARCH.lastname, :lastname) distance_last,
   dbo.LEVENSHTEIN (USEARCH.e_mail, :e_mail) distance_mail,
   USER_ID,
   logonuid,
   e_mail,
   firstname,
   lastname,
   search_field,
   telephones
from   
    SCHEMA.USER_SEARCH USEARCH
)
select
   distance_logonuid,
   distance_first,
   distance_last,
   distance_mail,
   USER_ID,
   logonuid,
   e_mail,
   firstname,
   lastname,
   search_field,
   telephones
from
    Search_distances
where   
   distance_logonuid < 20
   and distance_first < 20
   and distance_last < 20
   and distance_mail < 20


However this fails on the first word "with" :
Code:
01:16:52,384 ERROR PARSER:33 - line 1:1: unexpected token: with
Exception in thread "main" java.lang.IllegalArgumentException: node to traverse cannot be null!
   at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:31)
   at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:254)
   at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
   at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)


How should do ... ?
Use function as indicated here ?
Help / Hints / indications are appreciated ...


\T,


Top
 Profile  
 
 Post subject: Re: Problem calling Query using a function ...
PostPosted: Fri May 07, 2010 9:43 am 
Newbie

Joined: Wed Jul 26, 2006 4:18 pm
Posts: 8
Location: Brussels, Belgium
It works with
Code:
Query q = session.createSQLQuery(...)

I was using
Code:
Query q = session.createQuery(...)

Problem "solved".

\T,


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.