3.14. Oracle

3.14.1. Using Query Hints with Oracle
3.14.2. Known issues with Oracle

Example 3.14. Example properties for Oracle

kodo.ConnectionDriverName: oracle.jdbc.driver.OracleDriver
kodo.ConnectionURL: jdbc:oracle:thin:@SERVER_NAME:1521:DB_NAME

3.14.1. Using Query Hints with Oracle

Oracle has support for "query hints", which are formatted comments embedded in SQL that provide some hint for how the query should be executed. These hints are usually designed to provide suggestions to the Oracle query optimizer for how to efficiently perform a certainly query, and aren't typically needed for any but the most intensive queries.

Example 3.15. Using Oracle Hints

JDO:

Query query = pm.newQuery (...);
query.addExtension ("openjpa.hint.OracleSelectHint", "/*+ first_rows(100) */");
List results = (List) query.execute ();

JPA:

Query query = em.createQuery (...);
query.setHint ("openjpa.hint.OracleSelectHint", "/*+ first_rows(100) */");
List results = query.getResultList ();

3.14.2. Known issues with Oracle

  • The Oracle JDBC driver has significant differences between different versions. It is important to use the officially supported version of the driver (10.2.0.1.0), which is backward compatible with previous versions of the Oracle server.

  • For VARCHAR fields, null and a blank string are equivalent. This means that an object that stores a null string field will have it get read back as a blank string.

  • Oracle corp's JDBC driver for Oracle has only limited support for batch updates. The result for Kodo is that in some cases, the exact object that failed an optimistic lock check cannot be determined, and Kodo will throw an OptimisticVerificationException with more failed objects than actually failed.

  • Oracle cannot store numbers with more than 38 digits in numeric columns.

  • Floats and doubles may lose precision when stored.

  • CLOB columns cannot be used in queries.

 

Skip navigation bar   Back to Top