wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Help using OJB and Criteria.addLike()" Watch "Help using OJB and Criteria.addLike()" New topic
Author

Help using OJB and Criteria.addLike()

Raistlin Zischer
Greenhorn

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

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Raistlin Zischer
Greenhorn

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: http://aspose.com/file-tools
 
subject: Help using OJB and Criteria.addLike()
 
Similar Threads
Expression Language not supported in compile time attribute items
OJB Path Expression Relationship Problem
Should I remove those search criterion other than name+location
Need help searching imap folder for multiple recipients
Inline editing in JSF