Hi, guys I have a table abc_tbl. I want to write my own finder using EJB-QL. How can I conwert this SQL to EJB-QL? select id from abc_tbl where id=? and abc_date=(select max(abc_date) from abc_tbl where id=?) Thanx in advance, Jamal
Considering that both subselects and max functions are NOT part of standard EJB-QL the basic answer is probably "you can't". Different vendors offer extensions to EJB-QL for their own projects so there's a chance you might be able to write this using them in your container, but it's a slim one. Kyle
Thank you Kyle for fast reply, As I know th�re's MAX function in EJB-QL. id feld in my table is not unique. I had to choose the last (by edit date) record and give it to EJB. Do I have any chance to do it with CMP? Are there some pattern or solution or I had to do it with BMP? Thanx in advance, JAMAL
EJB-QL only contains a MAX function in EJB 2.1 or in some vendor modifications for EJB 2.0. Details on that can be found here. Instead of a subselect you might be able to do this as two queries. However, it turns out that Weblogic at least (see here) allows subqueries as a vendor-specific EJB-QL extension. What server are you using, anyway? Kyle