| 1 |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 |
<title>Registering DPL Secondary Keys</title> |
| 7 |
<link rel="stylesheet" href="gettingStarted.css" type="text/css" /> |
| 8 |
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 |
<link rel="start" href="index.html" title="Berkeley DB Installation and Build Guide" /> |
| 10 |
<link rel="up" href="upgrade_4_8_toc.html" title="Chapter 13. Upgrading Berkeley DB 4.7 applications to Berkeley DB 4.8" /> |
| 11 |
<link rel="prev" href="upgrade_4_8_toc.html" title="Chapter 13. Upgrading Berkeley DB 4.7 applications to Berkeley DB 4.8" /> |
| 12 |
<link rel="next" href="upgrade_4_8_mpool.html" title="Minor Change in Behavior of DB_MPOOLFILE->get" /> |
| 13 |
</head> |
| 14 |
<body> |
| 15 |
<div xmlns="" class="navheader"> |
| 16 |
<div class="libver"> |
| 17 |
<p>Library Version 11.2.5.3</p> |
| 18 |
</div> |
| 19 |
<table width="100%" summary="Navigation header"> |
| 20 |
<tr> |
| 21 |
<th colspan="3" align="center">Registering DPL Secondary Keys</th> |
| 22 |
</tr> |
| 23 |
<tr> |
| 24 |
<td width="20%" align="left"><a accesskey="p" href="upgrade_4_8_toc.html">Prev</a> </td> |
| 25 |
<th width="60%" align="center">Chapter 13. Upgrading Berkeley DB 4.7 applications to Berkeley DB 4.8</th> |
| 26 |
<td width="20%" align="right"> <a accesskey="n" href="upgrade_4_8_mpool.html">Next</a></td> |
| 27 |
</tr> |
| 28 |
</table> |
| 29 |
<hr /> |
| 30 |
</div> |
| 31 |
<div class="sect1" lang="en" xml:lang="en"> |
| 32 |
<div class="titlepage"> |
| 33 |
<div> |
| 34 |
<div> |
| 35 |
<h2 class="title" style="clear: both"><a id="upgrade_4_8_dpl"></a>Registering DPL Secondary Keys</h2> |
| 36 |
</div> |
| 37 |
</div> |
| 38 |
</div> |
| 39 |
<p> |
| 40 |
Entity subclasses that define secondary keys must now be registered |
| 41 |
prior to storing an instance of the class. This can be done in two |
| 42 |
ways: |
| 43 |
</p> |
| 44 |
<div class="itemizedlist"> |
| 45 |
<ul type="disc"> |
| 46 |
<li> |
| 47 |
<p> |
| 48 |
The <code class="methodname">EntityModel.registerClass()</code> method |
| 49 |
may be called to register the subclass before opening the |
| 50 |
entity store. |
| 51 |
</p> |
| 52 |
</li> |
| 53 |
<li> |
| 54 |
<p> |
| 55 |
The <code class="methodname">EntityStore.getSubclassIndex()</code> |
| 56 |
method may be called to implicitly register the subclass after |
| 57 |
opening the entity store. |
| 58 |
</p> |
| 59 |
</li> |
| 60 |
</ul> |
| 61 |
</div> |
| 62 |
<p> |
| 63 |
Failure to register the entity subclass will result in an |
| 64 |
<code class="classname">IllegalArgumentException</code> the first time an |
| 65 |
attempt is made to store an instance of the subclass. An exception will |
| 66 |
not occur if instances of the subclass have previously been stored, |
| 67 |
which allows existing applications to run unmodified in most cases. |
| 68 |
</p> |
| 69 |
<p> |
| 70 |
This behavioral change was made to increase reliability. In several |
| 71 |
cases, registering an entity subclass has been necessary as a |
| 72 |
workaround. The requirement to register the subclass will ensure that |
| 73 |
such errors do not occur in deployed applications. |
| 74 |
</p> |
| 75 |
</div> |
| 76 |
<div class="navfooter"> |
| 77 |
<hr /> |
| 78 |
<table width="100%" summary="Navigation footer"> |
| 79 |
<tr> |
| 80 |
<td width="40%" align="left"><a accesskey="p" href="upgrade_4_8_toc.html">Prev</a> </td> |
| 81 |
<td width="20%" align="center"> |
| 82 |
<a accesskey="u" href="upgrade_4_8_toc.html">Up</a> |
| 83 |
</td> |
| 84 |
<td width="40%" align="right"> <a accesskey="n" href="upgrade_4_8_mpool.html">Next</a></td> |
| 85 |
</tr> |
| 86 |
<tr> |
| 87 |
<td width="40%" align="left" valign="top">Chapter 13. Upgrading Berkeley DB 4.7 applications to Berkeley DB 4.8 </td> |
| 88 |
<td width="20%" align="center"> |
| 89 |
<a accesskey="h" href="index.html">Home</a> |
| 90 |
</td> |
| 91 |
<td width="40%" align="right" valign="top"> Minor Change in Behavior of DB_MPOOLFILE->get</td> |
| 92 |
</tr> |
| 93 |
</table> |
| 94 |
</div> |
| 95 |
</body> |
| 96 |
</html> |