| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>20. Oracle</title><base href="display"><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="manual.html" title="Apache OpenJPA 2.4 User's Guide"><link rel="up" href="supported_databases.html" title="Appendix 2. Supported Databases"><link rel="prev" href="dbsupport_mysql.html" title="19. MySQL"><link rel="next" href="dbsupport_pointbase.html" title="21. Pointbase"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">20. |
| Oracle |
| </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dbsupport_mysql.html">Prev</a> </td><th width="60%" align="center">Appendix 2. |
| Supported Databases |
| </th><td width="20%" align="right"> <a accesskey="n" href="dbsupport_pointbase.html">Next</a></td></tr></table><hr></div><div class="section" id="dbsupport_oracle"><div class="titlepage"><div><div><h2 class="title" style="clear: both">20. |
| Oracle |
| </h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="dbsupport_oracle.html#dbsupport_oracle_query_hints">20.1. |
| Using Query Hints with Oracle |
| </a></span></dt><dt><span class="section"><a href="dbsupport_oracle.html#dbsupport_oracle_issues">20.2. |
| Known issues with Oracle |
| </a></span></dt></dl></div> |
| |
| <div class="example" id="example_props_oracle"><p class="title"><b>Example 2.17. |
| Example properties for Oracle |
| </b></p><div class="example-contents"> |
| |
| <pre class="programlisting"> |
| openjpa.ConnectionDriverName: oracle.jdbc.driver.OracleDriver |
| openjpa.ConnectionURL: jdbc:oracle:thin:@SERVER_NAME:1521:DB_NAME |
| </pre> |
| </div></div><br class="example-break"> |
| <div class="section" id="dbsupport_oracle_query_hints"><div class="titlepage"><div><div><h3 class="title">20.1. |
| Using Query Hints with Oracle |
| </h3></div></div></div> |
| |
| <p> |
| 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 certain query, and aren't typically needed for any but |
| the most intensive queries. |
| </p> |
| <div class="example" id="dbsupport_oracle_query_hints_ex"><p class="title"><b>Example 2.18. |
| Using Oracle Hints |
| </b></p><div class="example-contents"> |
| |
| <pre class="programlisting"> |
| Query query = em.createQuery(...); |
| query.setHint("openjpa.hint.OracleSelectHint", "/*+ first_rows(100) */"); |
| List results = query.getResultList(); |
| </pre> |
| </div></div><br class="example-break"> |
| </div> |
| <div class="section" id="dbsupport_oracle_issues"><div class="titlepage"><div><div><h3 class="title">20.2. |
| Known issues with Oracle |
| </h3></div></div></div> |
| |
| <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> |
| <p> |
| The Oracle JDBC driver has significant differences between different versions. |
| It is important to use the officially supported version of the drivers |
| (10.2.0.1.0/11.2.0.x.0), which is backward compatible with previous versions of the Oracle |
| server. It can be downloaded from |
| <a class="ulink" href="http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html" target="_top"> |
| http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html</a>. |
| </p> |
| </li><li class="listitem"> |
| <p> |
| Empty string/char values are stored as NULL. |
| </p> |
| </li><li class="listitem"> |
| <p> |
| Oracle corp's JDBC driver for Oracle has only limited support for batch updates. |
| The result for OpenJPA is that batching of some statements may fail and in some cases, |
| the exact object that failed an optimistic lock check cannot be determined. OpenJPA will |
| throw an <code class="classname">OptimisticException</code> with more failed objects than actually |
| failed. This situation may be resolved by disabling statement batching by setting the |
| batchLimit value to zero or by using a more recent Oracle JDBC Driver (11.2.0.1) with |
| batch support improvements. Attempting to resolve the issue with a more current driver |
| is recommended since disabling statement batching can result in a decrease in performance. |
| </p><div class="example" id="dbsupport_oracle_disable_batch_updates"><p class="title"><b>Example 2.19. |
| Property to disable statement batching for Oracle |
| </b></p><div class="example-contents"> |
| |
| <pre class="programlisting"> |
| openjpa.jdbc.DBDictionary: oracle(batchLimit=0) |
| </pre> |
| </div></div><p><br class="example-break"> |
| </p> |
| </li><li class="listitem"> |
| <p> |
| Oracle cannot store numbers with more than 38 digits in numeric columns. |
| </p> |
| </li><li class="listitem"> |
| <p> |
| Floats and doubles may lose precision when stored. |
| </p> |
| </li><li class="listitem"> |
| <p> |
| CLOB columns cannot be used in queries. |
| </p> |
| </li><li class="listitem"> |
| <p> |
| The use of LOBs with persistent attributes of a streaming data type (ex. |
| <code class="literal">java.io.InputStream</code> or <code class="literal">java.io.Reader</code>) may |
| require the same connection to be used over the life of the transaction or |
| entity manager. If the same connection is not used for persistent operations |
| a <code class="literal">java.io.IOException</code> with message <code class="literal">Closed Connection |
| </code> may result. The OpenJPA property <code class="literal">openjpa.ConnectionRetainMode</code> |
| can be used to control how OpenJPA uses datastore connections. See |
| <a class="xref" href="ref_guide_dbsetup_retain.html" title="8. Configuring the Use of JDBC Connections">Section 8, “ |
| Configuring the Use of JDBC Connections |
| ”</a> for details. |
| </p><div class="example" id="dbsupport_oracle_retain_connection"><p class="title"><b>Example 2.20. |
| Property to retain connection over the lifetime of the entity manager |
| </b></p><div class="example-contents"> |
| |
| <pre class="programlisting"> |
| openjpa.ConnectionRetainMode: always |
| </pre> |
| </div></div><p><br class="example-break"> |
| </p> |
| </li><li class="listitem"> |
| <p> |
| Mapping persistent attributes to <a class="link" href="ref_guide_mapping_jpa.html#ref_guide_xmlmapping" title="7.10. XML Column Mapping">XML columns</a> requires |
| a JDBC 4 compliant driver if XML strings are longer than 4000 bytes, as counted in database. |
| Otherwise an <code class="literal">ORA-01461: can bind a LONG value only for insert into a LONG column</code> |
| error may result. |
| </p> |
| </li><li class="listitem"> |
| <p> |
| If Oracle dictionary property <code class="literal">MaxEmbeddedBlobSize</code> or |
| <code class="literal">MaxEmbeddedClobSize</code> is set to some limit (i.e. not -1) and embedded collection |
| with BLOB/CLOB attribute is used, a |
| <code class="literal">"org.apache.openjpa.persistence.ArgumentException: |
| "x.y.z.EmbedOwner.embedCollection<element:class x.y.z.EmbedValue>" |
| is mapped as embedded, but embedded field |
| "x.y.z.EmbedOwner.embedCollection.x.y.z.EmbedValue.blob" is not embeddable. |
| Embedded element/key/value types are limited to simple fields and direct relations to other |
| persistent types"</code> error may result. To overcome this limitation, either use JDBC driver |
| 11.2.0.x.0 (or later version) or set both <code class="literal">MaxEmbeddedBlobSize</code> and |
| <code class="literal">MaxEmbeddedClobSize</code> properties to -1. |
| </p> |
| </li></ul></div> |
| </div> |
| </div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="dbsupport_mysql.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="supported_databases.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="dbsupport_pointbase.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">19. |
| MySQL |
| </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 21. |
| Pointbase |
| </td></tr></table></div></body></html> |