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.  [ 3 posts ] 
Author Message
 Post subject: DifferenceExpression
PostPosted: Tue Aug 11, 2009 6:50 am 
Newbie

Joined: Tue Aug 11, 2009 6:28 am
Posts: 3
I wonder if anyone has used the DifferenceExpression, I am trying to use it to do a sounds like search on person names when our user checks the sounds like check box

I then have this code snippet below when creating the criteria

Code:
if (enableSoundex)
        {
          disjunction.Add(new DifferenceExpression("Surname", submittedName, DifferenceExpression.Strength.Strong));
        }
        else
        {
          disjunction.Add(Expression.Eq("Surname", submittedName));
        }


The problem is that when the soundex search is hit the generated sql is correct, but the parameter is not sent to the database with the query.
If the soundex isnt selected and it runs the equal expression the sql and parameters are all sent to the database correctly

Am I using the DifferenceExpression correctly? Do I have to do something else to ensure the parameter is sent with the query?

The sql sent to the db is below (its quite long so I have just included the end of the query as thats the part where I am having problems). You can see at the end of the query it is making reference to @p1 parameter, but it is not in the parameters at the end of the query-
Code:
exec sp_executesql N'... WHERE (Difference(@p1, familyname2_.Name) >= 3) and personname1_.Id = name1_.Id) ORDER BY name1_.Active desc',N'@p0 bit',@p0=1


Worth noting is that if I try to run the query manually adding the parameter to the end myself, the query runs producing the desired results

Ment to mention, the inner exception error picked up by visual studio is
Quote:
{"Must declare the scalar variable \"@p1\"."}


Top
 Profile  
 
 Post subject: Re: DifferenceExpression
PostPosted: Thu Aug 13, 2009 5:09 am 
Newbie

Joined: Tue Aug 11, 2009 6:28 am
Posts: 3
I should have mentioned. It seemed to be upgrading nhibernate from version 1.2 to 2.0 that stopped it working


Top
 Profile  
 
 Post subject: Re: DifferenceExpression
PostPosted: Mon Aug 31, 2009 5:56 am 
Newbie

Joined: Tue Aug 11, 2009 6:28 am
Posts: 3
Anyone know anything about the DifferenceExpression or where I can find any information/documentation about it? Help would be greatly appreciated


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.