EJB-QL only supports very few 'sql' keywords and functions. max(x) not being one of 
them. So I guess you cannot do this in CMP, or at least not in EJB2.0 (which is not 
even fully supported in WSAD 4.0.3.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 6:51 PM
To: [EMAIL PROTECTED]
Subject: Enterprise Bean QL


Suppositions:
I need to find a Bean using max(EDT_RMK_CREAT_D_T).   (timestamp)

EDT_RMK_CREAT_D_T is part of the key (the last field)

running on WSAD 4.0.3

(Essentially, this is an inner join, using keys from outer select to match
on inner select)

"Standard" SQL:
select * from DTXRQ001.XRT_EDIT_CHK_REM e where e.DIST_C = ? and e.SER_ID_R
= ? and e.ASOF_D = ? and e.RESP_ID_R = ? and e.FORM_R = ? and e.EDIT_TYP_C
= ? and e.EDIT_INTRS_ID_R = ? and e.EDT_CHK_R = ? and e.EDT_CHK_ITM_ID_C
= ? and e.EDT_CHK_ITM_OCRN_R = ? and e.EDT_RMK_CREAT_D_T = ( select
max(EDT_RMK_CREAT_D_T) from DTXRQ001.XRT_EDIT_CHK_REM f where f.DIST_C =
e.DIST_C and f.SER_ID_R = e.SER_ID_R and f.ASOF_D = e.ASOF_D and
f.RESP_ID_R = e.RESP_ID_R and f.FORM_R = e.FORM_R and f.EDIT_TYP_C =
e.EDIT_TYP_C and f.EDIT_INTRS_ID_R = e.EDIT_INTRS_ID_R and f.EDT_CHK_R =
e.EDT_CHK_R and f.EDT_CHK_ITM_ID_C = e.EDT_CHK_ITM_ID_C and
f.EDT_CHK_ITM_OCRN_R = e.EDT_CHK_ITM_OCRN_R)

EB QL which doesn't compile:
select e from StarRemarkBean e where and e.district = ?1 and e.seriesId
= ?2  and e.asofDate = ?3  and e.respondentId = ?4 and e.formNumber = ?5
and e.editTypeCode = ?6 and e.InterseriesComparisonId = ?7 and
e.editCheckNumber = ?8 and e.itemCode = ?9 and e.itemCodeOccurrence = ?10
and e.createDateTime = ( select max(createDateTime)    from StarRemarkBean
f    where f.asofDate = ?3   and f.InterseriesComparisonId = ?7   and
f.district = ?1   and f.editCheckNumber = ?8   and f.editTypeCode = ?6
and f.itemCode = ?9   and f.itemCodeOccurrence = ?10   and f.respondentId
= ?4   and f.seriesId = ?2   and f.formNumber = ?5  )


Any thoughts on making this work using EBQL?

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

==========================================================================To 
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to