two queries combined together into a single one

i am working with springs and hibernates, till now i am able to do all the hqls which are required in my project, but now i am facing a typical task.

the thing is i have a table in which it contain 5 column out which 2 are important for my work(current one), they are FIRST NAME and LAST NAME, till now i used to perform only on FIRST NAME or making use of 'and' in the query in combination of another row.

but now i want to perform the query in such a way that it has to search in both FIRST NAME as well as LAST NAME not FIRST NAME and LAST NAME. it has to return any match of my input for both FIRST NAME and LAST NAME.

i am searching on my database table using hibernate for like search(i;e exact match), begins with & contains on FIRST NAME column now i want to perform the same operation on both the columns now with the same input give for the FIRST NAME

not that the hibernate has to search for the matching pattern in the FIRST NAME and then go for the LAST NAME, it has to perform the same operation on both column in a single query

the thing is just now i have rectified it, i have done the same earlier but found an error but it is not the fault in the hql but the parameter set in dao,
i regret that, i have rectified it myself
but thank you for resolving it.

binu narayanan

Ranch Hand

Posts: 60

posted 6 years ago

Now then the problem has been solved you can post the hql so that it will be helpful for others

saipraneeth nallapareddy

Ranch Hand

Posts: 159

posted 6 years ago

@binu narayanan
sorry if you have been expecting this & i have delayed in posting the reply, here is the ans