Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ejb-ql with java.sql.Date or java.util.Date ?

I need to query the cmp entity bean over a RANGE OF DATE. Currently, the column type "DATE" (java.sql.Date) doesnt allow me to do the query, error returned during ejb-ql statement validation (first param. and second param. are both java type java.sql.Date):

select object(b) from MyEntity b where b.MYDATE > ?1 and b.MYDATE > ?2

select object(b) from MyEntity b where b.MYDATE between ?1 and ?2

i also saw http://help.sap.com/saphelp_nw04s/helpdata/en/13/dbb2b66146934a9662918755038ea1/frameset.htm

"If a cmp-field represents a date type and will be involved in a QL query, its Java type must be java.util.Date.”

Does it meant in order to query over a range of date, the table column type has to be "TIMESTAMP" and use java type java.util.Date? Or, is there any other option to get what i want?

Any help would be much appreciated.

Not what you were looking for? View more on this topic or Ask a question