> Does anybody know how to interpret the following EJB 2.0 spec. statement
> (11.2.11 Restrictions):
>
> "Date and time values should use standard Java long milliseconds value."
>
> This is "very" precise, I must say. X values should use Y value, hm....
>
> Does this mean that parameters to findXXX methods should be
> "long" type when
> used in date and time comparisons in EJB QL? What type of parameters does
> JBossCMP expect (accept) when used in such comparisons?

use new Date().getTime()

This concrete point is arised in the J2EE Quiz on java.sun.com these days (a
quite stupid doc link, but hey :)

I would try java.lang.Long

> I tried the following:
>
>          <query>
>             <query-method>
>                <method-name>findInDatetimeRange</method-name>
>                <method-params>
>                   <method-param>long</method-param>
>                   <method-param>long</method-param>
>                </method-params>
>             </query-method>
>
>             <result-type-mapping>Local</result-type-mapping>
>
>             <ejb-ql>SELECT DISTINCT OBJECT(c) FROM Contact AS c WHERE
> c.datetime &gt;= ?1 AND c.datetime &lt; ?2</ejb-ql>
>          </query>
>
> and the following:
>
>          <query>
>             <query-method>
>                <method-name>findInDatetimeRange</method-name>
>                <method-params>
>                   <method-param>java.util.Date</method-param>
>                   <method-param>java.util.Date</method-param>
>                </method-params>
>             </query-method>
>
>             <result-type-mapping>Local</result-type-mapping>
>
>             <ejb-ql>SELECT DISTINCT OBJECT(c) FROM Contact AS c WHERE
> c.datetime &gt;= ?1 AND c.datetime &lt; ?2</ejb-ql>
>          </query>
>
> and even the following:
>
>         <query>
>             <query-method>
>                <method-name>findInDatetimeRange</method-name>
>                <method-params>
>                   <method-param>java.sql.Timestamp</method-param>
>                   <method-param>java.sql.Timestamp</method-param>
>                </method-params>
>             </query-method>
>
>             <result-type-mapping>Local</result-type-mapping>
>
>             <ejb-ql>SELECT DISTINCT OBJECT(c) FROM Contact AS c WHERE
> c.datetime &gt;= ?1 AND c.datetime &lt; ?2</ejb-ql>
>          </query>
>
> The "datetime" field in Contact bean is:
>
>          <cmp-field>
>             <field-name>datetime</field-name>
>             <column-name>datetime</column-name>
>             <sql-type>DATETIME</sql-type>
>             <jdbc-type>TIMESTAMP</jdbc-type>
>          </cmp-field>
>
>
> Entity creation and reading of this fileld work correctly for this
> configuration...
>
> Regards, Peter
>
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development
>
>


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to