Skip Headers

Oracle® Application Server Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 2 (10.1.2)
Part No. B15505-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Oracle EJB QL Type Extensions: Date, Time, Timestamp, and SQRT

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:

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>