The moose likes Object Relational Mapping and the fly likes Querying All Fields Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Querying All Fields" Watch "Querying All Fields" New topic
Author

Querying All Fields

Pradeep Chandrasekharan Nair
Ranch Hand

Joined: Apr 01, 2004
Posts: 48
Hi,

I have one keyword field in UI and I need to search all fields in the table for that keyword value. Is there any Class like Example (this is to search for a given instance) available for this.

Thanks in Advance

Regards
Pradep
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 16624

Unfortunately there really isn't. However what you could do is include a "formula" attribute in your class that will combine all the fields into one field then do a like query on it. But well. I would probably not map that because that would mean that combination of all fields would always take place even when you didn't need it. So I would probably write a method to do it with the object once it returns from the query.

The other thing to check out is Hibernate's new search functionality, I forgot what it was called but you can find it at hibernate.org

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
IntelliJ Java IDE
 
subject: Querying All Fields
 
Threads others viewed
NX: (contractors) Implementing the Find() method
related links query
How to use the keyword for searching?
Another problem with syntax for SQL statement
EJB QL LIKE Operator
jQuery in Action, 2nd edition