Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0
Name and version of the database you are using: SQL 2000
I am trying to figure out the best way to implement the following search. It is simplified of course for example sake, there are a lot of tables that come into play before getting to those three. But it all comes down to these 3 tables:
Object 1,* -> Property 1,* -> Value
Input is submitted over the web, so to paint the picture user can have 3 boxes. 1 text, 2 select. Each box is a Property and select boxes are filled with default Values.
So on search the sql would be something like:
select a.* from object a, property b1,property b2, property b3, value c1, value c2, value c3
where
a.id = b1.objectid and
a.id = b2.objectid and
a.id = b3.objectid and
b1.id = c1.propertyid and
b2.id = c2.propertyid and
b3.id = c3.propertyid and
b1.id = 1 and (c1.value like '%keyword%')
and
b2.id = 2 and (c2.value = '4' or c2.value ='7' or c2.value ='9')
and
b3.id = 3 and (c3.value = '3' or c3.value ='4')
-------------------------------------------------------------------------------
value filed of value table here is a string which can either contain text from a text box or an id of an item in teh drop down box.
So thats pretty much a summary of it. I am looking for the best way to do it. HQL or using Criteria, any suggestions? maybe an example of how to approach it. Thank you very much.