I have a case where I am given 2 IDs and there are 2 columns,assuming names'subj'and 'obj' in a table.If the Id's dont match in a single row, then i have to take the obj value and search for its entry in some other row in the subj column and then try to match the object iteratively. the search ends when there is no subject entry for a particular object. There is no with clause in hql and hence this question.
Example lets say i am given 1,100. Then i have to search for 1 and then get its object entry, if it is not 100 and lets say it is 20, i have to take that 20 and search for 20,100 , and once again it is not 100 in object entry, i have to repeat the process. This is possible in sql, but since there is no with clause in HQL i need suggestions.
I can always do it in the application but i am looking for another answer! The search ends when there is no corresponding subject entry for an object entry, or when it matches.