Forums Register Login

Multiple values in condition.

+Pie Number of slices to send: Send
Hey,

I need to load entities by set of attributes values.

I can do it with query like this:
select from supplier where ( (name ="name1" and address="address1" and city="city1") OR (name="name1" and address="address2" and city="city2") .... )


Queries like this suffer from performance issues, so i do this by creating temp table in the DB before run the query. (the input for the query and the number of criterion set are changed for each input).

In hibernate i can do it by criteria or by HQL (any idea if i can do any tricky name-query here?).

Just want to hear from you about your implementation for this.
do you do it in hibernate at all?

Thank you

+Pie Number of slices to send: Send
If you have indexes on those columns, then I think your performance would be much quicker. Get an explain plan for that query and I think you will see because you don't have an index for them that they are doing table scans.

Mark
+Pie Number of slices to send: Send
cant have index.

the keys is defined by the customers and each customer has its own keys.
+Pie Number of slices to send: Send
 

avihai marchiano wrote:cant have index.

the keys is defined by the customers and each customer has its own keys.



Then you will have slow performance. It is all about the database in this case. Not the query or Hibernate.

Mark
grapes are vegan food pellets. Eat this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 910 times.
Similar Threads
resultset return null
Any one have idea regarding this query??
How to query a value typed object
Problem with SQL uqery or DSN
Inheritance Trouble
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 01:29:56.