-->
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.  [ 1 post ] 
Author Message
 Post subject: Criteria+Expression.Sql() And Joined-subclass
PostPosted: Fri Jul 21, 2006 3:23 pm 
Newbie

Joined: Sat Jan 21, 2006 8:30 pm
Posts: 6
Hi,

Here it is:
Code:
<class name="Vehicle" ...>
  <property name="Name"/>
  <joined-subclass name="Car" ...>
    ....
  </joined-subclass>
  ...
</class>


At some point in my criteria, I need to add a SQL query to use MSQL2000 fulltext search.
The code looks like this:
Code:
oCriteria = oSession.CreateCriteria("Car");
...
oCriteria = oCriteria.Add(Expression.Sql("CONTAINS(Name, " + oKeywords + ")));

My query uses some other tables and "Name", as is, becomes ambiguous.
I tried using "{alias}" (i.e. "...CONTAINS({alias}.Name ...") but it doesn't work as the criteria is based on "Car", not "Vehicle" (which makes sense since the query generated is like "...FROM Car this INNER JOIN Vehicle ...", so "this" doesn't refer to Vehicle).

Is there a way I can get that to work?
Can I create a criteria/sub-criteria on the base class?
Any other ideas?


Luc.


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

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.