File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help using OJB and Criteria.addLike()

 
Raistlin Zischer
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using org.apache.ojb.broker.query.Criteria and doing the following:
searchTerm = "%rt%;
Criteria c = new Criteria();
c.addLike("%", searchTerm);

IContainer container = Container.getContainer(c);

Whenever I run this in my action, I get a SQLException. I want to be able to search all the fields in a given table without having to write out all the columns for the given table. Is there a quick way to do this?

By the way, the SQL code that is generated by this is similar to SELECT A0.column1,A0.column2,etc. FROM container A0 WHERE % LIKE '%rt%'
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

Neither JiG Beginner (where the original was before I deleted it) nor JiG Advanced (where this duplicate is) is appropriate for this message. I'm going to move this to our Other Open Source Projects forum, and let's see how you do over there. Another good choice might have been our JDBC forum. Please don't post duplicate threads, though.
 
Raistlin Zischer
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe I should explain why I am wanting to do this. That way, someone may be able to help me come up with a different way of doing this, if it's not possible to do it the way I want/need to. I am trying to create a search feature for my webapp. I need to be able to search the ENTIRE database for a given string. This includes all field names of all non-OJB tables. The only thing the webapp will know before running my searches is the search string that will be past to it from the current html form. Any ideas will be welcome, thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic