-->
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.  [ 6 posts ] 
Author Message
 Post subject: scrollableResults, full text indexes and createSQLQuery
PostPosted: Thu May 27, 2004 1:40 pm 
Newbie

Joined: Thu May 27, 2004 1:25 pm
Posts: 3
tools
Hibernate 2.1.1
SQL SERVER database

I am trying to build a search engine for my database, and am using a full text index with a contains clause. I am putting the results in a scrollableResult so that i can display the results 20 per page.

With this code:
ScrollableResults sr = null;
try {
Session session = HibernateSession.getSession();
if (className != null) {
Query q = session.createSQLQuery(qry, "scrollable", className);
sr = q.scroll();
}

I get the following:
12:13:30,929 ERROR HibernateDataManager:153 - EXCEPTION
java.lang.UnsupportedOperationException: SQL queries do not currently support iteration at net.sf.hibernate.impl.SQLQueryImpl.scroll(SQLQueryImpl.java:60)
at org.guidestar.database.dm.HibernateDataManager.retrieveScrollableObjQry(HibernateDataManager.java:146)
at org.guidestar.uk.search.dm.UkSearchDataManager.getUkSearchResults(UkSearchDataManager.java:85)

I have found that if I dont use createSQLQuery, that HIbernate doesn't seem to support the syntax for the CONTAINS Cluase. Is this true?
To me it seems like a normal thing to do, get the count and if i get the right number of results, display them. maybe it's just in my world. but i did not find much if any documentation of FAQ's about my situation. I did find that for some reason I had to go back to straight JDBC just to get the count, do I have to do the same for the task i am trying to achieve?

Dave


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 1:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can in the moment not use scroll with createSQLQuery. I suggest you put a limit clause in your query and do paging that way.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 2:16 pm 
Newbie

Joined: Thu May 27, 2004 1:25 pm
Posts: 3
if createSQLQuery can not support iterate or scroll, does HQL support the CONTAINS clause?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 2:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
in the where-clause most likely yes ... what is the syntax in SQL?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 2:47 pm 
Newbie

Joined: Thu May 27, 2004 1:25 pm
Posts: 3
example --
SELECT COUNT(*) as count FROM Uk_Search uks
WHERE ( CONTAINS ( uks.orgName, '"HOMEBOUND" AND "CRAFTSMEN" AND "TRUST"') )

when i originally tested this i was running the following query (three different fields, just more paren's...Hibernate was complaining about the number of paren's --

SELECT COUNT(*) as count FROM Uk_Search uks
WHERE ( (CONTAINS ( uks.orgName, '"HOMEBOUND" AND "CRAFTSMEN" AND "TRUST"') ) or (CONTAINS ( uks.orgAbbrev, '"HOMEBOUND" AND "CRAFTSMEN" AND "TRUST"') ) or (CONTAINS ( uks.altName, '"HOMEBOUND" AND "CRAFTSMEN" AND "TRUST"') ) )


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 2:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Hm yes, this might probably confuse the parser - no other solution so as to use limit clauses together with createSqlQuery.


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