Hi all,

We're upgrading our app to Nhibernate version 3.2, and it seems that
the like function behaves a bit differently,
..Well, nor really the like function, but the command that is send to
SQL Server.
Now I've done a lot of searching, and it seems that there is a lot of
fuzz about those SetParameterSizes and etc stuff..; I've tried to
subclass the driver and to prepare the statements, but none of them
gave me the behavior back as in NH2.
I really hope there is a solution already but the search of google
keeps me getting the problem of that parametersizes thingie. Also,
the bugs on Nhibernate are closed without a comment, why there will be
no fix...

Ok, now the actual problem:
Consider this property of a class called Person:

<property name="Code" column="Code" length="3" not-null="true" unique-
key="Code" />

With some values: 123,523,321,235

If I send a like criteria: like '%2%', NH2 Count: 4 & NH3 Count: 4 =
good
If I send a like criteria: like '%23%, NH2 Count: 3 & NH3 Count: 2 =
difference..

This is because, sql server will turn it into:
like %23

if I want the same behavior without changing the mapping files, i have
to intercept code:

If Mode = Anyware then
var criteria1 = Create one like: %23
var criteria2 = Create one like: 23%
Restriction.Or(criteria1,critera2)

There is another solution:
chaging the mapping files:
<property name="Code" column="Code" length="3" type=String(5) not-
null="true" unique-key="Code" />

But in sql server the select string
Select Code where Code like '%23%' just works.

Now my question:

- Is this a result because the whole parametersize discussion? =>
Queryplan optimalisations...?
- Where could I intercept this code to change the 'type size'? In the
driver? => it seems to me ,that I do not want to alter the size, if
there is no like function used...
- Could I do my mapping fix, without breaking something in the future?
- What is your opion on the solution to change the criteria creation,
and make wrapper class around it to make sure a right query has been
created...

Thanks for information,







-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to