File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Help using OJB and Criteria.addLike() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Help using OJB and Criteria.addLike()" Watch "Help using OJB and Criteria.addLike()" New topic

Help using OJB and Criteria.addLike()

Raistlin Zischer

Joined: Jul 05, 2005
Posts: 25
I'm using 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

Joined: Jul 08, 2003
Posts: 24199


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.

[Jess in Action][AskingGoodQuestions]
Raistlin Zischer

Joined: Jul 05, 2005
Posts: 25
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:
subject: Help using OJB and Criteria.addLike()
jQuery in Action, 3rd edition