Boolean Method Expression

62 views
Skip to first unread message

Danielg

unread,
Sep 28, 2010, 5:43:47 PM9/28/10
to nhibernate-development
I am really enjoying the new features in NH 3 for extending the Linq
provider. I have run into a block when trying to implement the MsSQL
FREETEXT method.

WHERE FREETEXT (ColumnName, 'text' )

I have tried creating a new generator that uses the treeBuilder to
create a method call, however this produces a runtime exception.

Unable to cast object of type 'NHibernate.Hql.Ast.HqlMethodCall' to
type 'NHibernate.Hql.Ast.HqlBooleanExpression'.

The where clause is expecting that its expression will be a boolean
expression. I cannot use the treebuilder.Equality because there is
only one side to the expression. Can someone point me in the right
direction? Or is this possible with the current build? I am running
off the trunk.

Patrick Earl

unread,
Sep 29, 2010, 12:13:24 PM9/29/10
to nhibernate-...@googlegroups.com
I haven't tried this, but you might be able to compare with true as a work-around.

        Patrick Earl

Wenig, Stefan

unread,
Sep 29, 2010, 12:17:10 PM9/29/10
to nhibernate-...@googlegroups.com
Just guessing, but might work - try to build this expression:
Contains (...) == true

Sent from my HTC phone

----- Ursprüngliche Nachricht -----
Von: Danielg <nic...@gmail.com>
Gesendet: Mittwoch, 29. September 2010 11:01
An: nhibernate-development <nhibernate-...@googlegroups.com>
Betreff: [nhibernate-development] Boolean Method Expression

Danielg

unread,
Sep 29, 2010, 2:22:47 PM9/29/10
to nhibernate-development
Thanks for the suggestions. I did try that and it does compile
successfully, but SQL cannot execute a Contains(...) = true
expression.

Danielg

unread,
Sep 30, 2010, 6:25:41 PM9/30/10
to nhibernate-development
I submitted a patch that allows these methods to be registered.

http://216.121.112.228/browse/NH-2357

Hopefully it is accepted.
Reply all
Reply to author
Forward
0 new messages