<html><head> | |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
<title>3. OpenJPA 2.3.0</title><base href="display"><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="manual.html" title="Apache OpenJPA 2.4 User's Guide"><link rel="up" href="migration_considerations.html" title="Appendix 3. Migration Considerations"><link rel="prev" href="jpa_2.2.html" title="2. OpenJPA 2.2.0"></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">3. | |
OpenJPA 2.3.0 | |
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="jpa_2.2.html">Prev</a> </td><th width="60%" align="center">Appendix 3. | |
Migration Considerations | |
</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="section" title="3. OpenJPA 2.3.0"><div class="titlepage"><div><div><h2 class="title" style="clear: both" id="jpa_2.3">3. | |
OpenJPA 2.3.0 | |
</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="jpa_2.3.html#jpa_2.3_incompatibilities">3.1. Incompatibilities</a></span></dt><dd><dl><dt><span class="section"><a href="jpa_2.3.html#jpa_2.3_MappingTool">3.1.1. | |
MappingTool Behavior for DB2 and Derby | |
</a></span></dt><dt><span class="section"><a href="jpa_2.3.html#jpa_2.3_RequiresSearchStringEscapeForLike">3.1.2. | |
RequiresSearchStringEscapeForLike DBDictionary Property | |
</a></span></dt><dt><span class="section"><a href="jpa_2.3.html#ReturnNullOnEmptyAggregateResult">3.1.3. | |
Return value of aggregate functions in SELECT clause | |
</a></span></dt></dl></dd></dl></div> | |
<div class="section" title="3.1. Incompatibilities"><div class="titlepage"><div><div><h3 class="title" id="jpa_2.3_incompatibilities">3.1. Incompatibilities</h3></div></div></div><div class="toc"><dl><dt><span class="section"><a href="jpa_2.3.html#jpa_2.3_MappingTool">3.1.1. | |
MappingTool Behavior for DB2 and Derby | |
</a></span></dt><dt><span class="section"><a href="jpa_2.3.html#jpa_2.3_RequiresSearchStringEscapeForLike">3.1.2. | |
RequiresSearchStringEscapeForLike DBDictionary Property | |
</a></span></dt><dt><span class="section"><a href="jpa_2.3.html#ReturnNullOnEmptyAggregateResult">3.1.3. | |
Return value of aggregate functions in SELECT clause | |
</a></span></dt></dl></div> | |
<p> | |
The following sections indicate changes that are incompatible | |
between OpenJPA 2.2.x releases and the 2.3.0 release. | |
</p> | |
<div class="section" title="3.1.1. MappingTool Behavior for DB2 and Derby"><div class="titlepage"><div><div><h4 class="title" id="jpa_2.3_MappingTool">3.1.1. | |
MappingTool Behavior for DB2 and Derby | |
</h4></div></div></div> | |
<p> | |
In previous releases, the MappingTool mapped <code class="literal">java.math.BigDecimal</code> fields to the database type | |
DOUBLE, and as such, ignored <code class="literal">column</code> and <code class="literal">precision</code> values that might have been specified via the | |
<code class="literal">javax.persistence.Column</code> annotation. | |
</p> | |
<p> | |
From the 2.3.0 release, <code class="literal">java.math.BigDecimal</code> fields are now mapped to the database type DECIMAL | |
and it is very likely that you will need to specify <code class="literal">column</code> and <code class="literal">precision</code> via | |
the <code class="literal">javax.persistence.Column</code> annotation. | |
</p> | |
</div> | |
<div class="section" title="3.1.2. RequiresSearchStringEscapeForLike DBDictionary Property"><div class="titlepage"><div><div><h4 class="title" id="jpa_2.3_RequiresSearchStringEscapeForLike">3.1.2. | |
RequiresSearchStringEscapeForLike DBDictionary Property | |
</h4></div></div></div> | |
<p> | |
In previous releases, the default value for the property RequiresSearchStringEscapeForLike is true and caused the | |
unexpected escape clause appended to the SQL statement. | |
For example, user created a named query like this: | |
</p><pre class="programlisting"> SELECT o.computerName FROM CompUser o WHERE o.name LIKE ?</pre><p> | |
At run time the following query is generated: | |
</p><pre class="programlisting"> SELECT t0.computerName FROM CompUser t0 WHERE (t0.name LIKE ? ESCAPE '\')</pre><p> | |
ESCAPE '\' shouldn't be appended to the query. | |
</p> | |
<p> | |
From the 2.3.0 release, RequiresSearchStringEscapeForLike property is set to false by default. You can configure | |
RequiresSearchStringEscapeForLike property to be true if the old behavior is desired. | |
</p> | |
</div> | |
<div class="section" title="3.1.3. Return value of aggregate functions in SELECT clause"><div class="titlepage"><div><div><h4 class="title" id="ReturnNullOnEmptyAggregateResult">3.1.3. | |
Return value of aggregate functions in SELECT clause | |
</h4></div></div></div> | |
<p> | |
The JPA specification states "If SUM, AVG, MAX, or MIN is used, and there are no values to which the aggregate function can be | |
applied, the result of the aggregate function is NULL." Prior to this update, OpenJPA incorrectly returned 0 for SUM, AVG, MIN, | |
and MAX when a state field being aggregated is numeric. This behavior affects both JPQL and Criteria queries. With this update, | |
OpenJPA will return a null result value for these aggregate functions when a query returns no result. | |
</p> | |
<p> | |
To re-enable the prior behavior, you need to set the following persistence property in your persistence.xml or when | |
creating an EntityManagerFactory. | |
</p><pre class="programlisting"> | |
<property name="openjpa.Compatibility" value="ReturnNullOnAggregateResult=false"/> | |
</pre><p> | |
</p> | |
</div> | |
</div> | |
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="jpa_2.2.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="migration_considerations.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top">2. | |
OpenJPA 2.2.0 | |
</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html> |