|
Oracle® Application Server Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 2 (10.1.2) Part No. B15505-01 |
|
![]() Previous |
![]() Next |
Even though the current version of the EJB specification does not support Date, Time, Timestamp, and SQRT, we have added support for these types, as follows:
SQRT(v) : Both the double primitive type and the java.lang.Double types are supported for arguments.
java.util.Date, java.sql.Date, java.sql.Time. and java.sql.Timestamp are allowed in an EJB QL binary expression, such as equality expressions.
The following show examples of how to use these EJB QL type extensions:
Example 7-3 Using SQRT
<query>
<query-method>
<method-name>ejbSelectDoubleTypeSqrt</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<result-type-mapping>Remote</result-type-mapping>
<ejb-ql>
SELECT OBJECT(a) FROM Dept a WHERE a.deptDoubleType = SQRT(?1)
</ejb-ql>
</query>
Example 7-4 Date Example
<query>
<query-method>
<method-name>ejbSelectDate</method-name>
<method-params>
<method-param>java.util.Date</method-param>
</method-params>
</query-method>
<result-type-mapping>Remote</result-type-mapping>
<ejb-ql>
SELECT OBJECT(a) FROM Dept a WHERE a.deptDate = ?1
</ejb-ql>
</query>
Example 7-5 Another Date Example
<query>
<query-method>
<method-name>ejbSelectSqlDate</method-name>
<method-params>
<method-param>java.sql.Date</method-param>
</method-params>
</query-method>
<result-type-mapping>Remote</result-type-mapping>
<ejb-ql>
SELECT OBJECT(a) FROM Dept a WHERE a.deptSqlDate = ?1
</ejb-ql>
</query>
Example 7-6 Timestamp Example
<query>
<query-method>
<method-name>findByTimestamp</method-name>
<method-params>
<method-param>java.sql.Timestamp</method-param>
</method-params>
</query-method>
<result-type-mapping>Remote</result-type-mapping>
<ejb-ql>
SELECT OBJECT(a) FROM Dept a WHERE a.deptTimestamp = ?1
</ejb-ql>
</query>
Example 7-7 Time Example
<query>
<query-method>
<method-name>findByTimestamp</method-name>
<method-params>
<method-param>java.sql.Time</method-param>
</method-params>
</query-method>
<result-type-mapping>Remote</result-type-mapping>
<ejb-ql>
SELECT OBJECT(a) FROM Dept a WHERE a.deptTime = ?1
</ejb-ql>
</query>