The following is writen to the server.log for one of my CMP 2.0 finder
methods (CVS jboss3.0alpha) during deployment:
2002-01-14 17:46:40,443 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.ContactBean.findInDatetimeRange]
EQL-QL: SELECT DISTINCT OBJECT(c) FROM Contact AS c WHERE c.datetime >= ?1
AND c.datetime < ?2
2002-01-14 17:46:41,098 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.ContactBean.findInDatetimeRange]
SQL: SELECT DISTINCT t1_c.id FROM ContactBean t1_c
...Where is the "WHERE" caluse in the SQL? Can this be a bug or am I missing
something?
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?
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 >= ?1 AND c.datetime < ?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 >= ?1 AND c.datetime < ?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 >= ?1 AND c.datetime < ?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