db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vladimir Figurov <vfigu...@asia-soft.kz>
Subject Re: HowTo make Criteria with use function in WHERE clause?
Date Thu, 29 Jul 2004 14:01:48 GMT
Thanks for "... Criteria.CUSTOM..." Scott !!!

after your help my BIG SELECT looking as:
...
      Criteria.Criterion contentSearch = 
crit.getNewCriterion(ContentsPeer.TABLE_NAME, 
"contains(CONTENT,'%"+searchForBLOB+"%') > 0", Criteria.CUSTOM);
      contentSearch.setTable(ContentsPeer.TABLE_NAME);
      // Search in Title (Oracle.VARCHAR2)
      Criteria.Criterion documentSearch = 
crit.getNewCriterion(DocumentsPeer.TITLE, (Object) 
("%"+searchForBLOB+"%"), Criteria.LIKE);
      // Union
      crit.add(contentSearch.or(documentSearch));
 ...
and excellent WORKING !!!
THANKS!!!!

Vladimir Figurov wrote:


Hello!
I use Oracle 9i and try use Text Search in BLOB field.
A simple Oracle code for text search is "SELECT ... FROM table_content
WHERE contains(blob_field, 'search_string')>0


How to build Criteria?
Criteria crit = new Criteria(ContentsPeer.DATABASE_NAME);
crit.add(ContentsPeer.TABLE_NAME, "contains(CONTENT,'%five%')", new
Integer(0), Criteria.GREATER_THAN);
returned a BAD Criterion :
crit.toString() : SELECT  FROM contents WHERE
contents.contains(CONTENT,'%five%')>0
and Oracle is not understand this Select ;-((


Have you tried Criteria.CUSTOM - there is an example at 
http://db.apache.org/torque/criteria-howto.html

Scott

-- 



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message