Hi,
I am new to criteria. below is my situation explained.
Table structure
Header |_Lines(1 - many) |_SKU(1 - many)
My query is to get Header object based on some conditions and most important is the latest revision number. All the tables have a column called rev_Nbr. I am searching PO's for a specific customer, the query will fetch all the PO's based on the customer but i need to fetch only latest PO's with the help of max revision number.
select * from header where poNbr in (select max(revNbr) from header where custId = ?) AND custId = ?;
How to achieve this using detached criteria. i am using detached criteria to run the query but i dont know how to add subquery to each detached criteria? Header, Lines, Sku each and every model respective criteria i have created but i dont know how to add subquery to each of the criteria?
|