Using SQL When JDOQL Is Not Sufficient


Although many SQL queries have their counterparts in JDOQL, there are some SQL queries that JDOQL cannot express. For example, SQL can perform operations on the returned result set. The group by clause and operators like min, max, and avg are cases in point. A JDO query cannot return the information that these SQL queries return. Instead, JDO requires a workaround. For example, the results collection can be processed in memory. In general, any SQL query that is designed to return something other than the state of individual objects does not have a counterpart in JDOQL.

JDO allows the implementation to provide access to the native query interface and language of the datastore. The following factory method in the persistence manager is the gateway to the alternate query language and interface:

 newQuery(String language, Object implDependentObject) 

Some vendors with object-to-relational implementations are using this method to support SQL queries.




Using and Understanding Java Data Objects
Using and Understanding Java Data Objects
ISBN: 1590590430
EAN: 2147483647
Year: 2005
Pages: 156
Authors: David Ezzio

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net