-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Best practices for search/multiple alias per table
PostPosted: Fri Dec 16, 2005 4:27 pm 
Newbie

Joined: Fri May 27, 2005 3:19 pm
Posts: 18
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.