Forums Register Login

Create a Sub Query in a Criteria Query

+Pie Number of slices to send: Send
Dear All,

Iam facing a problem in creating a sub query within a Criteria Query.Please help:

Sql Query

Select salary from employee_table where

name = Parameter.[name]
age = Parameter.[age]
dateofbirth = Select Max(dateofbirth) from employee_table
where name = Parameter.[name],
age = Parameter.[age],
dateofbirth < = Parameter.[dateofbirth]

Please help as iam stuck on dis code
+Pie Number of slices to send: Send
You can do that by using the 'DetachedCriteria' in hibernate

for e.g.-



since you are passing 'data' as a parameter, so what you do
1)create an object of detachedcriteria first,
2)add the expression,
3) and finally set the projection(in the 2nd line above code) using the 'max()'

refer the link below:-
Hibernate Criteria Queries

enjoy buddy .... :-)
+Pie Number of slices to send: Send
please buy my thing and then I'll have more money:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1739 times.
Similar Threads
Hibernate subquery
Cannot perform SQL UPDATE null
ProjectionList hibernate Criteria
counting slaries using query
How to check query within PreparedStatement object
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 09:02:23.