cancel
Showing results for 
Search instead for 
Did you mean: 

EJB QL query with dates

Former Member
0 Kudos

Hi all,

I'm trying to do an EJB QL with dates. I need to get the results which <i>fechaSolicitud</i> are between a data range (<i>fechaIni</i> and <i>fechaFin</i>).

In my db fechaSolicitud is of the type java.sql.Date. I have tried to do the query with the <i>fechaIni</i> and <i>fechaFin</i> beeing the following types: java.lang.Long, long, java.sql.Timestamp and java.sql.Date and the code of the query:

a) select object(b) from RenovacionesBean b where b.fechaSolicitud > ?1 and b.fechaSolicitud < ?2

b) select object(b) from RenovacionesBean b where b.fechaSolicitud between ?1 and ?2.

When I press the Validate button (with all the possible combinations) I get the following message: <i>EJB QL statement is invalid. See General User Output View for details.</i>.

There isn't neither Output View nor details where I can see which is the error.

Can somebody help me. I have search for this question in this forum and the sun developer forum and I get no valid solution.

Best regards,

Mireia

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

done

viliana
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Mireia,

There is a limitation on QL queries that involve data types:

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

For more information, see: <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/13/dbb2b66146934a9662918755038ea1/frameset.htm">http://help.sap.com/saphelp_nw04s/helpdata/en/13/dbb2b66146934a9662918755038ea1/frameset.htm</a>

Best regards,

Viliana