Skip to Content
Former Member
Apr 06, 2006 at 02:43 PM

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

"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.