mirror of
https://github.com/berkeleydb/je.git
synced 2024-11-15 01:46:24 +00:00
2097 lines
113 KiB
HTML
2097 lines
113 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!-- NewPage -->
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Generated by javadoc (1.8.0_151) on Tue Oct 31 17:36:46 EDT 2017 -->
|
|
<title>SecondaryIndex (Oracle - Berkeley DB Java Edition API)</title>
|
|
<meta name="date" content="2017-10-31">
|
|
<link rel="stylesheet" type="text/css" href="../../../style.css" title="Style">
|
|
<script type="text/javascript" src="../../../script.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
try {
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="SecondaryIndex (Oracle - Berkeley DB Java Edition API)";
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
//-->
|
|
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10};
|
|
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
|
var altColor = "altColor";
|
|
var rowColor = "rowColor";
|
|
var tableTab = "tableTab";
|
|
var activeTableTab = "activeTableTab";
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar.top">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.top.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/SecondaryIndex.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
<div class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
|
|
</div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../../com/sleepycat/persist/StoreConfig.html" title="class in com.sleepycat.persist"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?com/sleepycat/persist/SecondaryIndex.html" target="_top">Frames</a></li>
|
|
<li><a href="SecondaryIndex.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor.detail">Constr</a> | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle">com.sleepycat.persist</div>
|
|
<h2 title="Class SecondaryIndex" class="title">Class SecondaryIndex<SK,PK,E></h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li>java.lang.Object</li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>com.sleepycat.persist.SecondaryIndex<SK,PK,E></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<dl>
|
|
<dt>All Implemented Interfaces:</dt>
|
|
<dd><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><SK,E></dd>
|
|
</dl>
|
|
<hr>
|
|
<br>
|
|
<pre>public class <span class="typeNameLabel">SecondaryIndex<SK,PK,E></span>
|
|
extends java.lang.Object</pre>
|
|
<div class="block">The secondary index for an entity class and a secondary key.
|
|
|
|
<p><code>SecondaryIndex</code> objects are thread-safe. Multiple threads may
|
|
safely call the methods of a shared <code>SecondaryIndex</code> object.</p>
|
|
|
|
<p><code>SecondaryIndex</code> implements <a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist"><code>EntityIndex</code></a> to map the
|
|
secondary key type (SK) to the entity type (E). In other words, entities
|
|
are accessed by secondary key values.</p>
|
|
|
|
<p>The <a href="../../../com/sleepycat/persist/model/SecondaryKey.html" title="annotation in com.sleepycat.persist.model"><code>SecondaryKey</code></a> annotation may be used to define a secondary key
|
|
as shown in the following example.</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=MANY_TO_ONE)
|
|
String department;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}</pre>
|
|
|
|
<p>Before obtaining a <code>SecondaryIndex</code>, the <a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist"><code>PrimaryIndex</code></a> must
|
|
be obtained for the entity class. To obtain the <code>SecondaryIndex</code> call
|
|
<a href="../../../com/sleepycat/persist/EntityStore.html#getSecondaryIndex-com.sleepycat.persist.PrimaryIndex-java.lang.Class-java.lang.String-"><code>EntityStore.getSecondaryIndex</code></a>, passing
|
|
the primary index, the secondary key class and the secondary key name. For
|
|
example:</p>
|
|
|
|
<pre class="code">
|
|
EntityStore store = new EntityStore(...);
|
|
|
|
<code>PrimaryIndex<Long, Employee></code> primaryIndex =
|
|
store.getPrimaryIndex(Long.class, Employee.class);
|
|
|
|
<code>SecondaryIndex<String, Long, Employee></code> secondaryIndex =
|
|
store.getSecondaryIndex(primaryIndex, String.class, "department");</pre>
|
|
|
|
<p>Since <code>SecondaryIndex</code> implements the <a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist"><code>EntityIndex</code></a>
|
|
interface, it shares the common index methods for retrieving and deleting
|
|
entities, opening cursors and using transactions. See <a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist"><code>EntityIndex</code></a>
|
|
for more information on these topics.</p>
|
|
|
|
<p><code>SecondaryIndex</code> does <em>not</em> provide methods for inserting
|
|
and updating entities. That must be done using the <a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist"><code>PrimaryIndex</code></a>.</p>
|
|
|
|
<p>Note that a <code>SecondaryIndex</code> has three type parameters <code><SK,
|
|
PK, E></code> or in the example <code><String, Long, Employee></code> while a <a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist"><code>PrimaryIndex</code></a> has only two type parameters <code><PK, E></code> or <code><Long,
|
|
Employee></code>. This is because a <code>SecondaryIndex</code> has an extra level of
|
|
mapping: It maps from secondary key to primary key, and then from primary
|
|
key to entity. For example, consider this entity:</p>
|
|
|
|
<div><table class="code" border="1" summary="">
|
|
<tr><th>ID</th><th>Department</th><th>Name</th></tr>
|
|
<tr><td>1</td><td>Engineering</td><td>Jane Smith</td></tr>
|
|
</table></div>
|
|
|
|
<p>The <a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist"><code>PrimaryIndex</code></a> maps from id directly to the entity, or from
|
|
primary key 1 to the "Jane Smith" entity in the example. The <code>SecondaryIndex</code> maps from department to id, or from secondary key
|
|
"Engineering" to primary key 1 in the example, and then uses the <code>PrimaryIndex</code> to map from the primary key to the entity.</p>
|
|
|
|
<p>Because of this extra type parameter and extra level of mapping, a <code>SecondaryIndex</code> can provide more than one mapping, or view, of the entities
|
|
in the primary index. The main mapping of a <code>SecondaryIndex</code> is to
|
|
map from secondary key (SK) to entity (E), or in the example, from the
|
|
String department key to the Employee entity. The <code>SecondaryIndex</code>
|
|
itself, by implementing <code>EntityIndex<SK, E></code>, provides this
|
|
mapping.</p>
|
|
|
|
<p>The second mapping provided by <code>SecondaryIndex</code> is from secondary
|
|
key (SK) to primary key (PK), or in the example, from the String department
|
|
key to the Long id key. The <a href="../../../com/sleepycat/persist/SecondaryIndex.html#keysIndex"><code>keysIndex</code></a> method provides this
|
|
mapping. When accessing the keys index, the primary key is returned rather
|
|
than the entity. When only the primary key is needed and not the entire
|
|
entity, using the keys index is less expensive than using the secondary
|
|
index because the primary index does not have to be accessed.</p>
|
|
|
|
<p>The third mapping provided by <code>SecondaryIndex</code> is from primary key
|
|
(PK) to entity (E), for the subset of entities having a given secondary key
|
|
(SK). This mapping is provided by the <a href="../../../com/sleepycat/persist/SecondaryIndex.html#subIndex-SK-"><code>subIndex(SK)</code></a> method. A
|
|
sub-index is convenient when you are interested in working with the subset
|
|
of entities having a particular secondary key value, for example, all
|
|
employees in a given department.</p>
|
|
|
|
<p>All three mappings, along with the mapping provided by the <a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist"><code>PrimaryIndex</code></a>, are shown using example data in the <a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist"><code>EntityIndex</code></a>
|
|
interface documentation. See <a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist"><code>EntityIndex</code></a> for more information.</p>
|
|
|
|
<p>Note that when using an index, keys and values are stored and retrieved
|
|
by value not by reference. In other words, if an entity object is stored
|
|
and then retrieved, or retrieved twice, each object will be a separate
|
|
instance. For example, in the code below the assertion will always
|
|
fail.</p>
|
|
<pre class="code">
|
|
MyKey key = ...;
|
|
MyEntity entity1 = index.get(key);
|
|
MyEntity entity2 = index.get(key);
|
|
assert entity1 == entity2; // always fails!
|
|
</pre>
|
|
|
|
<h3>One-to-One Relationships</h3>
|
|
|
|
<p>A <a href="../../../com/sleepycat/persist/model/Relationship.html#ONE_TO_ONE"><code>ONE_TO_ONE</code></a> relationship, although less
|
|
common than other types of relationships, is the simplest type of
|
|
relationship. A single entity is related to a single secondary key value.
|
|
For example:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=ONE_TO_ONE)
|
|
String ssn;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}
|
|
|
|
<code>SecondaryIndex<String, Long, Employee></code> employeeBySsn =
|
|
store.getSecondaryIndex(primaryIndex, String.class, "ssn");</pre>
|
|
|
|
<p>With a <a href="../../../com/sleepycat/persist/model/Relationship.html#ONE_TO_ONE"><code>ONE_TO_ONE</code></a> relationship, the
|
|
secondary key must be unique; in other words, no two entities may have the
|
|
same secondary key value. If an attempt is made to store an entity having
|
|
the same secondary key value as another existing entity, a <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je"><code>DatabaseException</code></a> will be thrown.</p>
|
|
|
|
<p>Because the secondary key is unique, it is useful to lookup entities by
|
|
secondary key using <a href="../../../com/sleepycat/persist/EntityIndex.html#get-K-"><code>EntityIndex.get(K)</code></a>. For example:</p>
|
|
|
|
<pre class="code">
|
|
Employee employee = employeeBySsn.get(mySsn);</pre>
|
|
|
|
<h3>Many-to-One Relationships</h3>
|
|
|
|
<p>A <a href="../../../com/sleepycat/persist/model/Relationship.html#MANY_TO_ONE"><code>MANY_TO_ONE</code></a> relationship is the most
|
|
common type of relationship. One or more entities is related to a single
|
|
secondary key value. For example:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=MANY_TO_ONE)
|
|
String department;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}
|
|
|
|
<code>SecondaryIndex<String, Long, Employee></code> employeeByDepartment =
|
|
store.getSecondaryIndex(primaryIndex, String.class, "department");</pre>
|
|
|
|
<p>With a <a href="../../../com/sleepycat/persist/model/Relationship.html#MANY_TO_ONE"><code>MANY_TO_ONE</code></a> relationship, the
|
|
secondary key is not required to be unique; in other words, more than one
|
|
entity may have the same secondary key value. In this example, more than
|
|
one employee may belong to the same department.</p>
|
|
|
|
<p>The most convenient way to access the employees in a given department is
|
|
by using a sub-index. For example:</p>
|
|
|
|
<pre class="code">
|
|
<code>EntityIndex<Long, Entity></code> subIndex = employeeByDepartment.subIndex(myDept);
|
|
<code>EntityCursor<Employee></code> cursor = subIndex.entities();
|
|
try {
|
|
for (Employee entity : cursor) {
|
|
// Do something with the entity...
|
|
}
|
|
} finally {
|
|
cursor.close();
|
|
}</pre>
|
|
|
|
<h3>One-to-Many Relationships</h3>
|
|
|
|
<p>In a <a href="../../../com/sleepycat/persist/model/Relationship.html#ONE_TO_MANY"><code>ONE_TO_MANY</code></a> relationship, a single
|
|
entity is related to one or more secondary key values. For example:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=ONE_TO_MANY)
|
|
Set<String> emailAddresses = new HashSet<String>;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}
|
|
|
|
<code>SecondaryIndex<String, Long, Employee></code> employeeByEmail =
|
|
store.getSecondaryIndex(primaryIndex, String.class, "emailAddresses");</pre>
|
|
|
|
<p>With a <a href="../../../com/sleepycat/persist/model/Relationship.html#ONE_TO_MANY"><code>ONE_TO_MANY</code></a> relationship, the
|
|
secondary key must be unique; in other words, no two entities may have the
|
|
same secondary key value. In this example, no two employees may have the
|
|
same email address. If an attempt is made to store an entity having the
|
|
same secondary key value as another existing entity, a <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je"><code>DatabaseException</code></a> will be thrown.</p>
|
|
|
|
<p>Because the secondary key is unique, it is useful to lookup entities by
|
|
secondary key using <a href="../../../com/sleepycat/persist/EntityIndex.html#get-K-"><code>EntityIndex.get(K)</code></a>. For example:</p>
|
|
|
|
<pre class="code">
|
|
Employee employee = employeeByEmail.get(myEmailAddress);</pre>
|
|
|
|
<p>The secondary key field for a <a href="../../../com/sleepycat/persist/model/Relationship.html#ONE_TO_MANY"><code>ONE_TO_MANY</code></a> relationship must be an array or collection type. To access
|
|
the email addresses of an employee, simply access the collection field
|
|
directly. For example:</p>
|
|
|
|
<pre class="code">
|
|
Employee employee = primaryIndex.get(1); // Get the entity by primary key
|
|
employee.emailAddresses.add(myNewEmail); // Add an email address
|
|
primaryIndex.putNoReturn(1, employee); // Update the entity</pre>
|
|
|
|
<h3>Many-to-Many Relationships</h3>
|
|
|
|
<p>In a <a href="../../../com/sleepycat/persist/model/Relationship.html#MANY_TO_MANY"><code>MANY_TO_MANY</code></a> relationship, one
|
|
or more entities is related to one or more secondary key values. For
|
|
example:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=MANY_TO_MANY)
|
|
Set<String> organizations = new HashSet<String>;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}
|
|
|
|
<code>SecondaryIndex<String, Long, Employee></code> employeeByOrganization =
|
|
store.getSecondaryIndex(primaryIndex, String.class, "organizations");</pre>
|
|
|
|
<p>With a <a href="../../../com/sleepycat/persist/model/Relationship.html#MANY_TO_MANY"><code>MANY_TO_MANY</code></a> relationship, the
|
|
secondary key is not required to be unique; in other words, more than one
|
|
entity may have the same secondary key value. In this example, more than
|
|
one employee may belong to the same organization.</p>
|
|
|
|
<p>The most convenient way to access the employees in a given organization
|
|
is by using a sub-index. For example:</p>
|
|
|
|
<pre class="code">
|
|
<code>EntityIndex<Long, Entity></code> subIndex = employeeByOrganization.subIndex(myOrg);
|
|
<code>EntityCursor<Employee></code> cursor = subIndex.entities();
|
|
try {
|
|
for (Employee entity : cursor) {
|
|
// Do something with the entity...
|
|
}
|
|
} finally {
|
|
cursor.close();
|
|
}</pre>
|
|
|
|
<p>The secondary key field for a <a href="../../../com/sleepycat/persist/model/Relationship.html#MANY_TO_MANY"><code>MANY_TO_MANY</code></a> relationship must be an array or collection type. To access
|
|
the organizations of an employee, simply access the collection field
|
|
directly. For example:</p>
|
|
|
|
<pre class="code">
|
|
Employee employee = primaryIndex.get(1); // Get the entity by primary key
|
|
employee.organizations.remove(myOldOrg); // Remove an organization
|
|
primaryIndex.putNoReturn(1, employee); // Update the entity</pre>
|
|
|
|
<h3>Foreign Key Constraints for Related Entities</h3>
|
|
|
|
<p>In all the examples above the secondary key is treated only as a simple
|
|
value, such as a <code>String</code> department field. In many cases, that is
|
|
sufficient. But in other cases, you may wish to constrain the secondary
|
|
keys of one entity class to be valid primary keys of another entity
|
|
class. For example, a Department entity may also be defined:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Department {
|
|
|
|
@PrimaryKey
|
|
String name;
|
|
|
|
String missionStatement;
|
|
|
|
private Department() {}
|
|
}</pre>
|
|
|
|
<p>You may wish to constrain the department field values of the Employee
|
|
class in the examples above to be valid primary keys of the Department
|
|
entity class. In other words, you may wish to ensure that the department
|
|
field of an Employee will always refer to a valid Department entity.</p>
|
|
|
|
<p>You can implement this constraint yourself by validating the department
|
|
field before you store an Employee. For example:</p>
|
|
|
|
<pre class="code">
|
|
<code>PrimaryIndex<String, Department></code> departmentIndex =
|
|
store.getPrimaryIndex(String.class, Department.class);
|
|
|
|
void storeEmployee(Employee employee) throws DatabaseException {
|
|
if (departmentIndex.contains(employee.department)) {
|
|
primaryIndex.putNoReturn(employee);
|
|
} else {
|
|
throw new IllegalArgumentException("Department does not exist: " +
|
|
employee.department);
|
|
}
|
|
}</pre>
|
|
|
|
<p>Or, instead you could define the Employee department field as a foreign
|
|
key, and this validation will be done for you when you attempt to store the
|
|
Employee entity. For example:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=MANY_TO_ONE, relatedEntity=Department.class)
|
|
String department;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}</pre>
|
|
|
|
<p>The <code>relatedEntity=Department.class</code> above defines the department
|
|
field as a foreign key that refers to a Department entity. Whenever a
|
|
Employee entity is stored, its department field value will be checked to
|
|
ensure that a Department entity exists with that value as its primary key.
|
|
If no such Department entity exists, then a <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je"><code>DatabaseException</code></a> is
|
|
thrown, causing the transaction to be aborted (assuming that transactions
|
|
are used).</p>
|
|
|
|
<p>This begs the question: What happens when a Department entity is deleted
|
|
while one or more Employee entities have department fields that refer to
|
|
the deleted department's primary key? If the department were allowed to be
|
|
deleted, the foreign key constraint for the Employee department field would
|
|
be violated, because the Employee department field would refer to a
|
|
department that does not exist.</p>
|
|
|
|
<p>By default, when this situation arises the system does not allow the
|
|
department to be deleted. Instead, a <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je"><code>DatabaseException</code></a> is thrown,
|
|
causing the transaction to be aborted. In this case, in order to delete a
|
|
department, the department field of all Employee entities must first be
|
|
updated to refer to a different existing department, or set to null. This
|
|
is the responsibility of the application.</p>
|
|
|
|
<p>There are two additional ways of handling deletion of a Department
|
|
entity. These alternatives are configured using the <a href="../../../com/sleepycat/persist/model/SecondaryKey.html#onRelatedEntityDelete--"><code>SecondaryKey.onRelatedEntityDelete()</code></a> annotation property. Setting this
|
|
property to <a href="../../../com/sleepycat/persist/model/DeleteAction.html#NULLIFY"><code>DeleteAction.NULLIFY</code></a> causes the Employee department
|
|
field to be automatically set to null when the department they refer to is
|
|
deleted. This may or may not be desirable, depending on application
|
|
policies. For example:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
<code>@SecondaryKey(relate=MANY_TO_ONE, relatedEntity=Department.class,
|
|
onRelatedEntityDelete=NULLIFY)</code>
|
|
String department;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}</pre>
|
|
|
|
<p>The <a href="../../../com/sleepycat/persist/model/DeleteAction.html#CASCADE"><code>DeleteAction.CASCADE</code></a> value, on the other hand, causes the
|
|
Employee entities to be automatically deleted when the department they refer
|
|
to is deleted. This is probably not desirable in this particular example,
|
|
but is useful for parent-child relationships. For example:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Order {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
String description;
|
|
|
|
private Order() {}
|
|
}
|
|
|
|
@Entity
|
|
class OrderItem {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
<code>@SecondaryKey(relate=MANY_TO_ONE, relatedEntity=Order.class,
|
|
onRelatedEntityDelete=CASCADE)</code>
|
|
long orderId;
|
|
|
|
String description;
|
|
|
|
private OrderItem() {}
|
|
}</pre>
|
|
|
|
<p>The OrderItem orderId field refers to its "parent" Order entity. When an
|
|
Order entity is deleted, it may be useful to automatically delete its
|
|
"child" OrderItem entities.</p>
|
|
|
|
<p>For more information, see <a href="../../../com/sleepycat/persist/model/SecondaryKey.html#onRelatedEntityDelete--"><code>SecondaryKey.onRelatedEntityDelete()</code></a>.</p>
|
|
|
|
<h3>One-to-Many versus Many-to-One for Related Entities</h3>
|
|
|
|
<p>When there is a conceptual Many-to-One relationship such as Employee to
|
|
Department as illustrated in the examples above, the relationship may be
|
|
implemented either as Many-to-One in the Employee class or as One-to-Many in
|
|
the Department class.</p>
|
|
|
|
<p>Here is the Many-to-One approach.</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=MANY_TO_ONE, relatedEntity=Department.class)
|
|
String department;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}
|
|
|
|
@Entity
|
|
class Department {
|
|
|
|
@PrimaryKey
|
|
String name;
|
|
|
|
String missionStatement;
|
|
|
|
private Department() {}
|
|
}</pre>
|
|
|
|
<p>And here is the One-to-Many approach.</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}
|
|
|
|
@Entity
|
|
class Department {
|
|
|
|
@PrimaryKey
|
|
String name;
|
|
|
|
String missionStatement;
|
|
|
|
@SecondaryKey(relate=ONE_TO_MANY, relatedEntity=Employee.class)
|
|
Set<Long> employees = new HashSet<Long>;
|
|
|
|
private Department() {}
|
|
}</pre>
|
|
|
|
<p>Which approach is best? The Many-to-One approach better handles large
|
|
number of entities on the to-Many side of the relationship because it
|
|
doesn't store a collection of keys as an entity field. With Many-to-One a
|
|
Btree is used to store the collection of keys and the Btree can easily
|
|
handle very large numbers of keys. With One-to-Many, each time a related
|
|
key is added or removed the entity on the One side of the relationship,
|
|
along with the complete collection of related keys, must be updated.
|
|
Therefore, if large numbers of keys may be stored per relationship,
|
|
Many-to-One is recommended.</p>
|
|
|
|
<p>If the number of entities per relationship is not a concern, then you may
|
|
wish to choose the approach that is most natural in your application data
|
|
model. For example, if you think of a Department as containing employees
|
|
and you wish to modify the Department object each time an employee is added
|
|
or removed, then you may wish to store a collection of Employee keys in the
|
|
Department object (One-to-Many).</p>
|
|
|
|
<p>Note that if you have a One-to-Many relationship and there is no related
|
|
entity, then you don't have a choice -- you have to use One-to-Many because
|
|
there is no entity on the to-Many side of the relationship where a
|
|
Many-to-One key could be defined. An example is the Employee to email
|
|
addresses relationship discussed above:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=ONE_TO_MANY)
|
|
Set<String> emailAddresses = new HashSet<String>;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}</pre>
|
|
|
|
<p>For sake of argument imagine that each employee has thousands of email
|
|
addresses and employees frequently add and remove email addresses. To
|
|
avoid the potential performance problems associated with updating the
|
|
Employee entity every time an email address is added or removed, you could
|
|
create an EmployeeEmailAddress entity and use a Many-to-One relationship as
|
|
shown below:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}
|
|
|
|
@Entity
|
|
class EmployeeEmailAddress {
|
|
|
|
@PrimaryKey
|
|
String emailAddress;
|
|
|
|
@SecondaryKey(relate=MANY_TO_ONE, relatedEntity=Employee.class)
|
|
long employeeId;
|
|
|
|
private EmployeeEmailAddress() {}
|
|
}</pre>
|
|
|
|
<h3>Key Placement with Many-to-Many for Related Entities</h3>
|
|
|
|
<p>As discussed in the section above, one drawback of a to-Many relationship
|
|
(One-to-Many was discussed above and Many-to-Many is discussed here) is that
|
|
it requires storing a collection of keys in an entity. Each time a key is
|
|
added or removed, the containing entity must be updated. This has potential
|
|
performance problems when there are large numbers of entities on the to-Many
|
|
side of the relationship, in other words, when there are large numbers of
|
|
keys in each secondary key field collection.</p>
|
|
|
|
<p>If you have a Many-to-Many relationship with a reasonably small number of
|
|
entities on one side of the relationship and a large number of entities on
|
|
the other side, you can avoid the potential performance problems by defining
|
|
the secondary key field on the side with a small number of entities.</p>
|
|
|
|
<p>For example, in an Employee-to-Organization relationship, the number of
|
|
organizations per employee will normally be reasonably small but the number
|
|
of employees per organization may be very large. Therefore, to avoid
|
|
potential performance problems, the secondary key field should be defined in
|
|
the Employee class as shown below.</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Employee {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=MANY_TO_MANY, relatedEntity=Organization.class)
|
|
Set<String> organizations = new HashSet<String>;
|
|
|
|
String name;
|
|
|
|
private Employee() {}
|
|
}
|
|
|
|
@Entity
|
|
class Organization {
|
|
|
|
@PrimaryKey
|
|
String name;
|
|
|
|
String description;
|
|
}</pre>
|
|
|
|
<p>If instead a <code>Set<Long> members</code> key had been defined in the
|
|
Organization class, this set could potentially have a large number of
|
|
elements and performance problems could result.</p>
|
|
|
|
<h3>Many-to-Many Versus a Relationship Entity</h3>
|
|
|
|
<p>If you have a Many-to-Many relationship with a large number of entities
|
|
on <em>both</em> sides of the relationship, you can avoid the potential
|
|
performance problems by using a <em>relationship entity</em>. A
|
|
relationship entity defines the relationship between two other entities
|
|
using two Many-to-One relationships.</p>
|
|
|
|
<p>Imagine a relationship between cars and trucks indicating whenever a
|
|
particular truck was passed on the road by a particular car. A given car
|
|
may pass a large number of trucks and a given truck may be passed by a large
|
|
number of cars. First look at a Many-to-Many relationship between these two
|
|
entities:</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Car {
|
|
|
|
@PrimaryKey
|
|
String licenseNumber;
|
|
|
|
@SecondaryKey(relate=MANY_TO_MANY, relatedEntity=Truck.class)
|
|
Set<String> trucksPassed = new HashSet<String>;
|
|
|
|
String color;
|
|
|
|
private Car() {}
|
|
}
|
|
|
|
@Entity
|
|
class Truck {
|
|
|
|
@PrimaryKey
|
|
String licenseNumber;
|
|
|
|
int tons;
|
|
|
|
private Truck() {}
|
|
}</pre>
|
|
|
|
<p>With the Many-to-Many approach above, the <code>trucksPassed</code> set could
|
|
potentially have a large number of elements and performance problems could
|
|
result.</p>
|
|
|
|
<p>To apply the relationship entity approach we define a new entity class
|
|
named CarPassedTruck representing a single truck passed by a single car. We
|
|
remove the secondary key from the Car class and use two secondary keys in
|
|
the CarPassedTruck class instead.</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class Car {
|
|
|
|
@PrimaryKey
|
|
String licenseNumber;
|
|
|
|
String color;
|
|
|
|
private Car() {}
|
|
}
|
|
|
|
@Entity
|
|
class Truck {
|
|
|
|
@PrimaryKey
|
|
String licenseNumber;
|
|
|
|
int tons;
|
|
|
|
private Truck() {}
|
|
}
|
|
|
|
@Entity
|
|
class CarPassedTruck {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=MANY_TO_ONE, relatedEntity=Car.class)
|
|
String carLicense;
|
|
|
|
@SecondaryKey(relate=MANY_TO_ONE, relatedEntity=Truck.class)
|
|
String truckLicense;
|
|
|
|
private CarPassedTruck() {}
|
|
}</pre>
|
|
|
|
<p>The CarPassedTruck entity can be used to access the relationship by car
|
|
license or by truck license.</p>
|
|
|
|
<p>You may use the relationship entity approach because of the potential
|
|
performance problems mentioned above. Or, you may choose to use this
|
|
approach in order to store other information about the relationship. For
|
|
example, if for each car that passes a truck you wish to record how much
|
|
faster the car was going than the truck, then a relationship entity is the
|
|
logical place to store that property. In the example below the
|
|
speedDifference property is added to the CarPassedTruck class.</p>
|
|
|
|
<pre class="code">
|
|
@Entity
|
|
class CarPassedTruck {
|
|
|
|
@PrimaryKey
|
|
long id;
|
|
|
|
@SecondaryKey(relate=MANY_TO_ONE, relatedEntity=Car.class)
|
|
String carLicense;
|
|
|
|
@SecondaryKey(relate=MANY_TO_ONE, relatedEntity=Truck.class)
|
|
String truckLicense;
|
|
|
|
int speedDifference;
|
|
|
|
private CarPassedTruck() {}
|
|
}</pre>
|
|
|
|
<p>Be aware that the relationship entity approach adds overhead compared to
|
|
Many-to-Many. There is one additional entity and one additional secondary
|
|
key. These factors should be weighed against its advantages and the
|
|
relevant application access patterns should be considered.</p></div>
|
|
<dl>
|
|
<dt><span class="simpleTagLabel">Author:</span></dt>
|
|
<dd>Mark Hayes</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Summary</h3>
|
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colOne" scope="col">Constructor and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#SecondaryIndex-com.sleepycat.je.SecondaryDatabase-com.sleepycat.je.Database-com.sleepycat.persist.PrimaryIndex-java.lang.Class-com.sleepycat.bind.EntryBinding-">SecondaryIndex</a></span>(<a href="../../../com/sleepycat/je/SecondaryDatabase.html" title="class in com.sleepycat.je">SecondaryDatabase</a> database,
|
|
<a href="../../../com/sleepycat/je/Database.html" title="class in com.sleepycat.je">Database</a> keysDatabase,
|
|
<a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist">PrimaryIndex</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">PK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>> primaryIndex,
|
|
java.lang.Class<<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>> secondaryKeyClass,
|
|
<a href="../../../com/sleepycat/bind/EntryBinding.html" title="interface in com.sleepycat.bind">EntryBinding</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>> secondaryKeyBinding)</code>
|
|
<div class="block">Creates a secondary index without using an <code>EntityStore</code>.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Summary</h3>
|
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
|
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Method and Description</th>
|
|
</tr>
|
|
<tr id="i0" class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#contains-K-">contains</a></span>(K key)</code>
|
|
<div class="block">Checks for existence of a key in this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i1" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#contains-com.sleepycat.je.Transaction-K-com.sleepycat.je.LockMode-">contains</a></span>(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
K key,
|
|
<a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a> lockMode)</code>
|
|
<div class="block">Checks for existence of a key in this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i2" class="altColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#count--">count</a></span>()</code>
|
|
<div class="block">Returns a non-transactional count of the entities in this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i3" class="rowColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#count-long-">count</a></span>(long memoryLimit)</code>
|
|
<div class="block">Returns a non-transactional count of the entities in this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i4" class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#delete-K-">delete</a></span>(K key)</code>
|
|
<div class="block">Deletes all entities with a given index key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i5" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#delete-com.sleepycat.je.Transaction-K-">delete</a></span>(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
K key)</code>
|
|
<div class="block">Deletes all entities with a given index key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i6" class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/OperationResult.html" title="class in com.sleepycat.je">OperationResult</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#delete-com.sleepycat.je.Transaction-K-com.sleepycat.je.WriteOptions-">delete</a></span>(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
K key,
|
|
<a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a> options)</code>
|
|
<div class="block">Deletes all entities with a given index key, using a WriteOptions
|
|
parameter and returning an OperationResult.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i7" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><E></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#entities--">entities</a></span>()</code>
|
|
<div class="block">Opens a cursor for traversing all entities in this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i8" class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><E></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#entities-K-boolean-K-boolean-">entities</a></span>(K fromKey,
|
|
boolean fromInclusive,
|
|
K toKey,
|
|
boolean toInclusive)</code>
|
|
<div class="block">Opens a cursor for traversing entities in a key range.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i9" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><E></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#entities-com.sleepycat.je.Transaction-com.sleepycat.je.CursorConfig-">entities</a></span>(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
<a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je">CursorConfig</a> config)</code>
|
|
<div class="block">Opens a cursor for traversing all entities in this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i10" class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><E></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#entities-com.sleepycat.je.Transaction-K-boolean-K-boolean-com.sleepycat.je.CursorConfig-">entities</a></span>(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
K fromKey,
|
|
boolean fromInclusive,
|
|
K toKey,
|
|
boolean toInclusive,
|
|
<a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je">CursorConfig</a> config)</code>
|
|
<div class="block">Opens a cursor for traversing entities in a key range.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i11" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#get-SK-">get</a></span>(<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a> key)</code>
|
|
<div class="block">Gets an entity via a key of this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i12" class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityResult.html" title="class in com.sleepycat.persist">EntityResult</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#get-com.sleepycat.je.Transaction-SK-com.sleepycat.je.Get-com.sleepycat.je.ReadOptions-">get</a></span>(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a> key,
|
|
<a href="../../../com/sleepycat/je/Get.html" title="enum in com.sleepycat.je">Get</a> getType,
|
|
<a href="../../../com/sleepycat/je/ReadOptions.html" title="class in com.sleepycat.je">ReadOptions</a> options)</code>
|
|
<div class="block">Gets an entity via a key of this index, using Get type and ReadOptions
|
|
parameters, and returning an EntityResult.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i13" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#get-com.sleepycat.je.Transaction-SK-com.sleepycat.je.LockMode-">get</a></span>(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a> key,
|
|
<a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a> lockMode)</code>
|
|
<div class="block">Gets an entity via a key of this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i14" class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/SecondaryDatabase.html" title="class in com.sleepycat.je">SecondaryDatabase</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#getDatabase--">getDatabase</a></span>()</code>
|
|
<div class="block">Returns the underlying secondary database for this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i15" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/bind/EntryBinding.html" title="interface in com.sleepycat.bind">EntryBinding</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#getKeyBinding--">getKeyBinding</a></span>()</code>
|
|
<div class="block">Returns the secondary key binding for the index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i16" class="altColor">
|
|
<td class="colFirst"><code>java.lang.Class<<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#getKeyClass--">getKeyClass</a></span>()</code>
|
|
<div class="block">Returns the secondary key class for this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i17" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/Database.html" title="class in com.sleepycat.je">Database</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#getKeysDatabase--">getKeysDatabase</a></span>()</code>
|
|
<div class="block">Returns the underlying secondary database that is not associated with
|
|
the primary database and is used for the <a href="../../../com/sleepycat/persist/SecondaryIndex.html#keysIndex"><code>keysIndex</code></a>.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i18" class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist">PrimaryIndex</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">PK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#getPrimaryIndex--">getPrimaryIndex</a></span>()</code>
|
|
<div class="block">Returns the primary index associated with this secondary index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i19" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><K></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#keys--">keys</a></span>()</code>
|
|
<div class="block">Opens a cursor for traversing all keys in this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i20" class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><K></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#keys-K-boolean-K-boolean-">keys</a></span>(K fromKey,
|
|
boolean fromInclusive,
|
|
K toKey,
|
|
boolean toInclusive)</code>
|
|
<div class="block">Opens a cursor for traversing keys in a key range.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i21" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><K></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#keys-com.sleepycat.je.Transaction-com.sleepycat.je.CursorConfig-">keys</a></span>(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
<a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je">CursorConfig</a> config)</code>
|
|
<div class="block">Opens a cursor for traversing all keys in this index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i22" class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><K></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#keys-com.sleepycat.je.Transaction-K-boolean-K-boolean-com.sleepycat.je.CursorConfig-">keys</a></span>(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
K fromKey,
|
|
boolean fromInclusive,
|
|
K toKey,
|
|
boolean toInclusive,
|
|
<a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je">CursorConfig</a> config)</code>
|
|
<div class="block">Opens a cursor for traversing keys in a key range.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i23" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">PK</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#keysIndex--">keysIndex</a></span>()</code>
|
|
<div class="block">Returns a read-only keys index that maps secondary key to primary key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i24" class="altColor">
|
|
<td class="colFirst"><code>java.util.Map<<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#map--">map</a></span>()</code>
|
|
<div class="block">Returns a standard Java map based on this entity index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i25" class="rowColor">
|
|
<td class="colFirst"><code>java.util.SortedMap<<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#sortedMap--">sortedMap</a></span>()</code>
|
|
<div class="block">Returns a standard Java sorted map based on this entity index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i26" class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">PK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/persist/SecondaryIndex.html#subIndex-SK-">subIndex</a></span>(<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a> key)</code>
|
|
<div class="block">Returns an index that maps primary key to entity for the subset of
|
|
entities having a given secondary key (duplicates).</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Methods inherited from class java.lang.Object</h3>
|
|
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="details">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Detail</h3>
|
|
<a name="SecondaryIndex-com.sleepycat.je.SecondaryDatabase-com.sleepycat.je.Database-com.sleepycat.persist.PrimaryIndex-java.lang.Class-com.sleepycat.bind.EntryBinding-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>SecondaryIndex</h4>
|
|
<pre>public SecondaryIndex(<a href="../../../com/sleepycat/je/SecondaryDatabase.html" title="class in com.sleepycat.je">SecondaryDatabase</a> database,
|
|
<a href="../../../com/sleepycat/je/Database.html" title="class in com.sleepycat.je">Database</a> keysDatabase,
|
|
<a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist">PrimaryIndex</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">PK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>> primaryIndex,
|
|
java.lang.Class<<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>> secondaryKeyClass,
|
|
<a href="../../../com/sleepycat/bind/EntryBinding.html" title="interface in com.sleepycat.bind">EntryBinding</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>> secondaryKeyBinding)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block">Creates a secondary index without using an <code>EntityStore</code>.
|
|
When using an <a href="../../../com/sleepycat/persist/EntityStore.html" title="class in com.sleepycat.persist"><code>EntityStore</code></a>, call <a href="../../../com/sleepycat/persist/EntityStore.html#getSecondaryIndex-com.sleepycat.persist.PrimaryIndex-java.lang.Class-java.lang.String-"><code>getSecondaryIndex</code></a> instead.
|
|
|
|
<p>This constructor is not normally needed and is provided for
|
|
applications that wish to use custom bindings along with the Direct
|
|
Persistence Layer. Normally, <a href="../../../com/sleepycat/persist/EntityStore.html#getSecondaryIndex-com.sleepycat.persist.PrimaryIndex-java.lang.Class-java.lang.String-"><code>getSecondaryIndex</code></a> is used instead.</p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>database</code> - the secondary database used for all access other than
|
|
via a <a href="../../../com/sleepycat/persist/SecondaryIndex.html#keysIndex"><code>keysIndex</code></a>.</dd>
|
|
<dd><code>keysDatabase</code> - another handle on the secondary database, opened
|
|
without association to the primary, and used only for access via a
|
|
<a href="../../../com/sleepycat/persist/SecondaryIndex.html#keysIndex"><code>keysIndex</code></a>. If this argument is null and the <a href="../../../com/sleepycat/persist/SecondaryIndex.html#keysIndex"><code>keysIndex</code></a>
|
|
method is called, then the keys database will be opened automatically;
|
|
however, the user is then responsible for closing the keys database. To
|
|
get the keys database in order to close it, call <a href="../../../com/sleepycat/persist/SecondaryIndex.html#getKeysDatabase--"><code>getKeysDatabase()</code></a>.</dd>
|
|
<dd><code>primaryIndex</code> - the primary index associated with this secondary
|
|
index.</dd>
|
|
<dd><code>secondaryKeyClass</code> - the class of the secondary key.</dd>
|
|
<dd><code>secondaryKeyBinding</code> - the binding to be used for secondary keys.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Detail</h3>
|
|
<a name="getDatabase--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getDatabase</h4>
|
|
<pre>public <a href="../../../com/sleepycat/je/SecondaryDatabase.html" title="class in com.sleepycat.je">SecondaryDatabase</a> getDatabase()</pre>
|
|
<div class="block">Returns the underlying secondary database for this index.</div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#getDatabase--">getDatabase</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>></code></dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the secondary database.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getKeysDatabase--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getKeysDatabase</h4>
|
|
<pre>public <a href="../../../com/sleepycat/je/Database.html" title="class in com.sleepycat.je">Database</a> getKeysDatabase()</pre>
|
|
<div class="block">Returns the underlying secondary database that is not associated with
|
|
the primary database and is used for the <a href="../../../com/sleepycat/persist/SecondaryIndex.html#keysIndex"><code>keysIndex</code></a>.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the keys database.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getPrimaryIndex--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getPrimaryIndex</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist">PrimaryIndex</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">PK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>> getPrimaryIndex()</pre>
|
|
<div class="block">Returns the primary index associated with this secondary index.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the primary index.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getKeyClass--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getKeyClass</h4>
|
|
<pre>public java.lang.Class<<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>> getKeyClass()</pre>
|
|
<div class="block">Returns the secondary key class for this index.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the class.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getKeyBinding--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getKeyBinding</h4>
|
|
<pre>public <a href="../../../com/sleepycat/bind/EntryBinding.html" title="interface in com.sleepycat.bind">EntryBinding</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>> getKeyBinding()</pre>
|
|
<div class="block">Returns the secondary key binding for the index.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the key binding.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="keysIndex--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>keysIndex</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">PK</a>> keysIndex()
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block">Returns a read-only keys index that maps secondary key to primary key.
|
|
When accessing the keys index, the primary key is returned rather than
|
|
the entity. When only the primary key is needed and not the entire
|
|
entity, using the keys index is less expensive than using the secondary
|
|
index because the primary index does not have to be accessed.
|
|
|
|
<p>Note the following in the unusual case that you are <em>not</em>
|
|
using an <code>EntityStore</code>: This method will open the keys
|
|
database, a second database handle for the secondary database, if it is
|
|
not already open. In this case, if you are <em>not</em> using an
|
|
<code>EntityStore</code>, then you are responsible for closing the
|
|
database returned by <a href="../../../com/sleepycat/persist/SecondaryIndex.html#getKeysDatabase--"><code>getKeysDatabase()</code></a> before closing the
|
|
environment. If you <em>are</em> using an <code>EntityStore</code>, the
|
|
keys database will be closed automatically by <a href="../../../com/sleepycat/persist/EntityStore.html#close--"><code>EntityStore.close()</code></a>.</p></div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the keys index.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="subIndex-java.lang.Object-">
|
|
<!-- -->
|
|
</a><a name="subIndex-SK-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>subIndex</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">PK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>> subIndex(<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a> key)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block">Returns an index that maps primary key to entity for the subset of
|
|
entities having a given secondary key (duplicates). A sub-index is
|
|
convenient when you are interested in working with the subset of
|
|
entities having a particular secondary key value.
|
|
|
|
<p>When using a <a href="../../../com/sleepycat/persist/model/Relationship.html#MANY_TO_ONE"><code>MANY_TO_ONE</code></a> or <a href="../../../com/sleepycat/persist/model/Relationship.html#MANY_TO_MANY"><code>MANY_TO_MANY</code></a> secondary key, the sub-index
|
|
represents the left (MANY) side of a relationship.</p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - the secondary key that identifies the entities in the
|
|
sub-index.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the sub-index.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="get-java.lang.Object-">
|
|
<!-- -->
|
|
</a><a name="get-SK-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>get</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a> get(<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a> key)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#get-K-">EntityIndex</a></code></span></div>
|
|
<div class="block">Gets an entity via a key of this index.
|
|
|
|
<p>The operation will not be transaction protected, and <a href="../../../com/sleepycat/je/LockMode.html#DEFAULT"><code>LockMode.DEFAULT</code></a> is used implicitly.</p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - the key to search for.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the value mapped to the given key, or null if the key is not
|
|
present in the index.
|
|
|
|
<!-- begin JE only --></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/OperationFailureException.html" title="class in com.sleepycat.je">OperationFailureException</a></code> - if one of the <a
|
|
href="../je/OperationFailureException.html#readFailures">Read Operation
|
|
Failures</a> occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.
|
|
<!-- end JE only --></dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="get-com.sleepycat.je.Transaction-java.lang.Object-com.sleepycat.je.LockMode-">
|
|
<!-- -->
|
|
</a><a name="get-com.sleepycat.je.Transaction-SK-com.sleepycat.je.LockMode-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>get</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a> get(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a> key,
|
|
<a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a> lockMode)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#get-com.sleepycat.je.Transaction-K-com.sleepycat.je.LockMode-">EntityIndex</a></code></span></div>
|
|
<div class="block">Gets an entity via a key of this index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>txn</code> - the transaction used to protect this operation, or null
|
|
if the operation should not be transaction protected.</dd>
|
|
<dd><code>key</code> - the key to search for.</dd>
|
|
<dd><code>lockMode</code> - the lock mode to use for this operation, or null to
|
|
use <a href="../../../com/sleepycat/je/LockMode.html#DEFAULT"><code>LockMode.DEFAULT</code></a>.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the value mapped to the given key, or null if the key is not
|
|
present in the index.
|
|
|
|
<!-- begin JE only --></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/OperationFailureException.html" title="class in com.sleepycat.je">OperationFailureException</a></code> - if one of the <a
|
|
href="../je/OperationFailureException.html#readFailures">Read Operation
|
|
Failures</a> occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.
|
|
<!-- end JE only --></dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="get-com.sleepycat.je.Transaction-java.lang.Object-com.sleepycat.je.Get-com.sleepycat.je.ReadOptions-">
|
|
<!-- -->
|
|
</a><a name="get-com.sleepycat.je.Transaction-SK-com.sleepycat.je.Get-com.sleepycat.je.ReadOptions-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>get</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityResult.html" title="class in com.sleepycat.persist">EntityResult</a><<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>> get(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a> key,
|
|
<a href="../../../com/sleepycat/je/Get.html" title="enum in com.sleepycat.je">Get</a> getType,
|
|
<a href="../../../com/sleepycat/je/ReadOptions.html" title="class in com.sleepycat.je">ReadOptions</a> options)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#get-com.sleepycat.je.Transaction-K-com.sleepycat.je.Get-com.sleepycat.je.ReadOptions-">EntityIndex</a></code></span></div>
|
|
<div class="block">Gets an entity via a key of this index, using Get type and ReadOptions
|
|
parameters, and returning an EntityResult.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>txn</code> - the transaction used to protect this operation, or null
|
|
if the operation should not be transaction protected.</dd>
|
|
<dd><code>key</code> - the key to search for.</dd>
|
|
<dd><code>getType</code> - must be <a href="../../../com/sleepycat/je/Get.html#SEARCH"><code>Get.SEARCH</code></a>.</dd>
|
|
<dd><code>options</code> - the ReadOptions, or null to use default options.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the EntityResult, including the value mapped to the given key,
|
|
or null if the key is not present in the index.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/OperationFailureException.html" title="class in com.sleepycat.je">OperationFailureException</a></code> - if one of the <a
|
|
href="../je/OperationFailureException.html#readFailures">Read Operation
|
|
Failures</a> occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="map--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>map</h4>
|
|
<pre>public java.util.Map<<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>> map()</pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#map--">EntityIndex</a></code></span></div>
|
|
<div class="block">Returns a standard Java map based on this entity index. The <a href="../../../com/sleepycat/collections/StoredMap.html" title="class in com.sleepycat.collections"><code>StoredMap</code></a> returned is defined by the <a href="../../../com/sleepycat/collections/package-summary.html">Collections API</a>. Stored collections conform
|
|
to the standard Java collections framework interface.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the map.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="sortedMap--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>sortedMap</h4>
|
|
<pre>public java.util.SortedMap<<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">SK</a>,<a href="../../../com/sleepycat/persist/SecondaryIndex.html" title="type parameter in SecondaryIndex">E</a>> sortedMap()</pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#sortedMap--">EntityIndex</a></code></span></div>
|
|
<div class="block">Returns a standard Java sorted map based on this entity index. The
|
|
<a href="../../../com/sleepycat/collections/StoredSortedMap.html" title="class in com.sleepycat.collections"><code>StoredSortedMap</code></a> returned is defined by the <a href="../../../com/sleepycat/collections/package-summary.html">Collections API</a>. Stored collections conform
|
|
to the standard Java collections framework interface.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the map.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="contains-java.lang.Object-">
|
|
<!-- -->
|
|
</a><a name="contains-K-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>contains</h4>
|
|
<pre>public boolean contains(K key)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#contains-K-">EntityIndex</a></code></span></div>
|
|
<div class="block">Checks for existence of a key in this index.
|
|
|
|
<p>The operation will not be transaction protected, and <a href="../../../com/sleepycat/je/LockMode.html#DEFAULT"><code>LockMode.DEFAULT</code></a> is used implicitly.</p>
|
|
|
|
<!-- begin JE only -->
|
|
<p><code>READ_UNCOMMITTED</code> can be used with this method to reduce I/O,
|
|
since the record data item will not be read. This is the same benefit
|
|
as described in <a href="#keyCursorReadUncommitted">Key Cursor
|
|
Optimization with READ_UNCOMMITTED</a></p>
|
|
<!-- end JE only --></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#contains-K-">contains</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - the key to search for.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>whether the key exists in the index.
|
|
|
|
<!-- begin JE only --></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/OperationFailureException.html" title="class in com.sleepycat.je">OperationFailureException</a></code> - if one of the <a
|
|
href="../je/OperationFailureException.html#readFailures">Read Operation
|
|
Failures</a> occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.
|
|
<!-- end JE only --></dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="contains-com.sleepycat.je.Transaction-java.lang.Object-com.sleepycat.je.LockMode-">
|
|
<!-- -->
|
|
</a><a name="contains-com.sleepycat.je.Transaction-K-com.sleepycat.je.LockMode-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>contains</h4>
|
|
<pre>public boolean contains(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
K key,
|
|
<a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a> lockMode)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#contains-com.sleepycat.je.Transaction-K-com.sleepycat.je.LockMode-">EntityIndex</a></code></span></div>
|
|
<div class="block">Checks for existence of a key in this index.
|
|
|
|
<!-- begin JE only -->
|
|
<p><code>READ_UNCOMMITTED</code> can be used with this method to reduce I/O,
|
|
since the record data item will not be read. This is the same benefit
|
|
as described in <a href="#keyCursorReadUncommitted">Key Cursor
|
|
Optimization with READ_UNCOMMITTED</a></p>
|
|
<!-- end JE only --></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#contains-com.sleepycat.je.Transaction-K-com.sleepycat.je.LockMode-">contains</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>txn</code> - the transaction used to protect this operation, or null
|
|
if the operation should not be transaction protected.</dd>
|
|
<dd><code>key</code> - the key to search for.</dd>
|
|
<dd><code>lockMode</code> - the lock mode to use for this operation, or null to
|
|
use <a href="../../../com/sleepycat/je/LockMode.html#DEFAULT"><code>LockMode.DEFAULT</code></a>.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>whether the key exists in the index.
|
|
|
|
<!-- begin JE only --></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/OperationFailureException.html" title="class in com.sleepycat.je">OperationFailureException</a></code> - if one of the <a
|
|
href="../je/OperationFailureException.html#readFailures">Read Operation
|
|
Failures</a> occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.
|
|
<!-- end JE only --></dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="count--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>count</h4>
|
|
<pre>public long count()
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#count--">EntityIndex</a></code></span></div>
|
|
<div class="block">Returns a non-transactional count of the entities in this index.
|
|
|
|
<!-- begin JE only -->
|
|
|
|
<p>This operation is faster than obtaining a count by scanning the index
|
|
manually, and will not perturb the current contents of the cache.
|
|
However, the count is not guaranteed to be accurate if there are
|
|
concurrent updates. Note that this method does scan a significant
|
|
portion of the index and should be considered a fairly expensive
|
|
operation.</p>
|
|
|
|
<p>This operation will disable deletion of log files by the JE log
|
|
cleaner during its execution and will consume a certain amount of
|
|
memory (but without affecting the memory that is available for the
|
|
JE cache). To avoid excessive memory consumption (and a potential
|
|
<code>OutOfMemoryError</code>) this method places an internal limit on
|
|
its memory consumption. If this limit is reached, the method will
|
|
still work properly, but its performance will degrade. To specify
|
|
a different memory limit than the one used by this method, use the
|
|
<a href="../../../com/sleepycat/persist/EntityIndex.html#count-long-"><code>EntityIndex.count(long memoryLimit)</code></a> method.</p>
|
|
|
|
<!-- end JE only --></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#count--">count</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the number of entities in this index.
|
|
|
|
<!-- begin JE only --></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/OperationFailureException.html" title="class in com.sleepycat.je">OperationFailureException</a></code> - if one of the <a
|
|
href="../je/OperationFailureException.html#readFailures">Read Operation
|
|
Failures</a> occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.
|
|
<!-- end JE only --></dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="count-long-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>count</h4>
|
|
<pre>public long count(long memoryLimit)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#count-long-">EntityIndex</a></code></span></div>
|
|
<div class="block">Returns a non-transactional count of the entities in this index.
|
|
|
|
<p>This operation is faster than obtaining a count by scanning the index
|
|
manually, and will not perturb the current contents of the cache.
|
|
However, the count is not guaranteed to be accurate if there are
|
|
concurrent updates. Note that this method does scan a significant
|
|
portion of the index and should be considered a fairly expensive
|
|
operation.</p>
|
|
|
|
<p>This operation will disable deletion of log files by the JE log
|
|
cleaner during its execution and will consume a certain amount of
|
|
memory (but without affecting the memory that is available for the
|
|
JE cache). To avoid excessive memory consumption (and a potential
|
|
<code>OutOfMemoryError</code>) this method takes as input an upper bound
|
|
on the memory it may consume. If this limit is reached, the method
|
|
will still work properly, but its performance will degrade.</p></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#count-long-">count</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the number of entities in this index.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/OperationFailureException.html" title="class in com.sleepycat.je">OperationFailureException</a></code> - if one of the <a
|
|
href="../je/OperationFailureException.html#readFailures">Read Operation
|
|
Failures</a> occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="delete-java.lang.Object-">
|
|
<!-- -->
|
|
</a><a name="delete-K-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>delete</h4>
|
|
<pre>public boolean delete(K key)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#delete-K-">EntityIndex</a></code></span></div>
|
|
<div class="block">Deletes all entities with a given index key.
|
|
|
|
<p>Auto-commit is used implicitly if the store is transactional.</p></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#delete-K-">delete</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - the key to search for.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>whether any entities were deleted.
|
|
|
|
<!-- begin JE only --></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/OperationFailureException.html" title="class in com.sleepycat.je">OperationFailureException</a></code> - if one of the <a
|
|
href="../je/OperationFailureException.html#writeFailures">Write
|
|
Operation Failures</a> occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.
|
|
<!-- end JE only --></dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="delete-com.sleepycat.je.Transaction-java.lang.Object-">
|
|
<!-- -->
|
|
</a><a name="delete-com.sleepycat.je.Transaction-K-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>delete</h4>
|
|
<pre>public boolean delete(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
K key)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#delete-com.sleepycat.je.Transaction-K-">EntityIndex</a></code></span></div>
|
|
<div class="block">Deletes all entities with a given index key.</div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#delete-com.sleepycat.je.Transaction-K-">delete</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>txn</code> - the transaction used to protect this operation, null to use
|
|
auto-commit, or null if the store is non-transactional.</dd>
|
|
<dd><code>key</code> - the key to search for.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>whether any entities were deleted.
|
|
|
|
<!-- begin JE only --></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/OperationFailureException.html" title="class in com.sleepycat.je">OperationFailureException</a></code> - if one of the <a
|
|
href="../je/OperationFailureException.html#writeFailures">Write
|
|
Operation Failures</a> occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.
|
|
<!-- end JE only --></dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="delete-com.sleepycat.je.Transaction-java.lang.Object-com.sleepycat.je.WriteOptions-">
|
|
<!-- -->
|
|
</a><a name="delete-com.sleepycat.je.Transaction-K-com.sleepycat.je.WriteOptions-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>delete</h4>
|
|
<pre>public <a href="../../../com/sleepycat/je/OperationResult.html" title="class in com.sleepycat.je">OperationResult</a> delete(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
K key,
|
|
<a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a> options)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#delete-com.sleepycat.je.Transaction-K-com.sleepycat.je.WriteOptions-">EntityIndex</a></code></span></div>
|
|
<div class="block">Deletes all entities with a given index key, using a WriteOptions
|
|
parameter and returning an OperationResult.</div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#delete-com.sleepycat.je.Transaction-K-com.sleepycat.je.WriteOptions-">delete</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>txn</code> - the transaction used to protect this operation, null to use
|
|
auto-commit, or null if the store is non-transactional.</dd>
|
|
<dd><code>key</code> - the key to search for.</dd>
|
|
<dd><code>options</code> - the WriteOptions, or null to use default options.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the OperationResult if any entities were deleted, else null. If</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/OperationFailureException.html" title="class in com.sleepycat.je">OperationFailureException</a></code> - if one of the <a
|
|
href="../je/OperationFailureException.html#writeFailures">Write
|
|
Operation Failures</a> occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.</dd>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="keys--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>keys</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><K> keys()
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#keys--">EntityIndex</a></code></span></div>
|
|
<div class="block">Opens a cursor for traversing all keys in this index.
|
|
|
|
<p>The operations performed with the cursor will not be transaction
|
|
protected, and <a href="../../../com/sleepycat/je/CursorConfig.html#DEFAULT"><code>CursorConfig.DEFAULT</code></a> is used implicitly. If the
|
|
store is transactional, the cursor may not be used to update or delete
|
|
entities.</p>
|
|
|
|
<!-- begin JE only -->
|
|
<p>Note that <code>READ_UNCOMMITTED</code> can be used with a key cursor to
|
|
reduce I/O, potentially providing significant performance benefits. See
|
|
<a href="#keyCursorReadUncommitted">Key Cursor Optimization with
|
|
READ_UNCOMMITTED</a></p>
|
|
<!-- end JE only --></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#keys--">keys</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the cursor.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="keys-com.sleepycat.je.Transaction-com.sleepycat.je.CursorConfig-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>keys</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><K> keys(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
<a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je">CursorConfig</a> config)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#keys-com.sleepycat.je.Transaction-com.sleepycat.je.CursorConfig-">EntityIndex</a></code></span></div>
|
|
<div class="block">Opens a cursor for traversing all keys in this index.
|
|
|
|
<!-- begin JE only -->
|
|
<p>Note that <code>READ_UNCOMMITTED</code> can be used with a key cursor to
|
|
reduce I/O, potentially providing significant performance benefits. See
|
|
<a href="#keyCursorReadUncommitted">Key Cursor Optimization with
|
|
READ_UNCOMMITTED</a></p>
|
|
<!-- end JE only --></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#keys-com.sleepycat.je.Transaction-com.sleepycat.je.CursorConfig-">keys</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>txn</code> - the transaction used to protect all operations performed with
|
|
the cursor, or null if the operations should not be transaction
|
|
protected. If the store is non-transactional, null must be specified.
|
|
For a transactional store the transaction is optional for read-only
|
|
access and required for read-write access.</dd>
|
|
<dd><code>config</code> - the cursor configuration that determines the default lock
|
|
mode used for all cursor operations, or null to implicitly use <a href="../../../com/sleepycat/je/CursorConfig.html#DEFAULT"><code>CursorConfig.DEFAULT</code></a>.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the cursor.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="entities--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>entities</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><E> entities()
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#entities--">EntityIndex</a></code></span></div>
|
|
<div class="block">Opens a cursor for traversing all entities in this index.
|
|
|
|
<p>The operations performed with the cursor will not be transaction
|
|
protected, and <a href="../../../com/sleepycat/je/CursorConfig.html#DEFAULT"><code>CursorConfig.DEFAULT</code></a> is used implicitly. If the
|
|
store is transactional, the cursor may not be used to update or delete
|
|
entities.</p></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#entities--">entities</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the cursor.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="entities-com.sleepycat.je.Transaction-com.sleepycat.je.CursorConfig-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>entities</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><E> entities(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
<a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je">CursorConfig</a> config)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#entities-com.sleepycat.je.Transaction-com.sleepycat.je.CursorConfig-">EntityIndex</a></code></span></div>
|
|
<div class="block">Opens a cursor for traversing all entities in this index.</div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#entities-com.sleepycat.je.Transaction-com.sleepycat.je.CursorConfig-">entities</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>txn</code> - the transaction used to protect all operations performed with
|
|
the cursor, or null if the operations should not be transaction
|
|
protected. If the store is non-transactional, null must be specified.
|
|
For a transactional store the transaction is optional for read-only
|
|
access and required for read-write access.</dd>
|
|
<dd><code>config</code> - the cursor configuration that determines the default lock
|
|
mode used for all cursor operations, or null to implicitly use <a href="../../../com/sleepycat/je/CursorConfig.html#DEFAULT"><code>CursorConfig.DEFAULT</code></a>.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the cursor.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="keys-java.lang.Object-boolean-java.lang.Object-boolean-">
|
|
<!-- -->
|
|
</a><a name="keys-K-boolean-K-boolean-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>keys</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><K> keys(K fromKey,
|
|
boolean fromInclusive,
|
|
K toKey,
|
|
boolean toInclusive)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#keys-K-boolean-K-boolean-">EntityIndex</a></code></span></div>
|
|
<div class="block">Opens a cursor for traversing keys in a key range.
|
|
|
|
<p>The operations performed with the cursor will not be transaction
|
|
protected, and <a href="../../../com/sleepycat/je/CursorConfig.html#DEFAULT"><code>CursorConfig.DEFAULT</code></a> is used implicitly. If the
|
|
store is transactional, the cursor may not be used to update or delete
|
|
entities.</p>
|
|
|
|
<!-- begin JE only -->
|
|
<p>Note that <code>READ_UNCOMMITTED</code> can be used with a key cursor to
|
|
reduce I/O, potentially providing significant performance benefits. See
|
|
<a href="#keyCursorReadUncommitted">Key Cursor Optimization with
|
|
READ_UNCOMMITTED</a></p>
|
|
<!-- end JE only --></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#keys-K-boolean-K-boolean-">keys</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>fromKey</code> - is the lower bound of the key range, or null if the range
|
|
has no lower bound.</dd>
|
|
<dd><code>fromInclusive</code> - is true if keys greater than or equal to fromKey
|
|
should be included in the key range, or false if only keys greater than
|
|
fromKey should be included.</dd>
|
|
<dd><code>toKey</code> - is the upper bound of the key range, or null if the range
|
|
has no upper bound.</dd>
|
|
<dd><code>toInclusive</code> - is true if keys less than or equal to toKey should be
|
|
included in the key range, or false if only keys less than toKey should
|
|
be included.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the cursor.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="keys-com.sleepycat.je.Transaction-java.lang.Object-boolean-java.lang.Object-boolean-com.sleepycat.je.CursorConfig-">
|
|
<!-- -->
|
|
</a><a name="keys-com.sleepycat.je.Transaction-K-boolean-K-boolean-com.sleepycat.je.CursorConfig-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>keys</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><K> keys(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
K fromKey,
|
|
boolean fromInclusive,
|
|
K toKey,
|
|
boolean toInclusive,
|
|
<a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je">CursorConfig</a> config)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#keys-com.sleepycat.je.Transaction-K-boolean-K-boolean-com.sleepycat.je.CursorConfig-">EntityIndex</a></code></span></div>
|
|
<div class="block">Opens a cursor for traversing keys in a key range.
|
|
|
|
<!-- begin JE only -->
|
|
<a name="keyCursorReadUncommitted"><h4>Key Cursor Optimization with
|
|
READ_UNCOMMITTED</h4></a>
|
|
|
|
<p>Using a key cursor potentially has a large performance benefit when
|
|
the <code>READ_UNCOMMITTED</code> isolation mode is used. In this case, if
|
|
the record data is not in the JE cache, it will not be read from disk.
|
|
The performance benefit is potentially large because random access disk
|
|
reads may be reduced. Examples are:</p>
|
|
<ul>
|
|
<li>Scanning all records in key order, when the entity is not needed and
|
|
<code>READ_UNCOMMITTED</code> isolation is acceptable.</li>
|
|
<li>Skipping over records quickly to perform approximate pagination with
|
|
<code>READ_UNCOMMITTED</code> isolation.</li>
|
|
</ul>
|
|
|
|
<p>For other isolation modes (<code>READ_COMMITTED</code>, <code>REPEATABLE_READ</code> and <code>SERIALIZABLE</code>), the performance benefit of a
|
|
key cursor is not as significant. In this case, the data item must be
|
|
read into the JE cache if it is not already present, in order to lock
|
|
the record. The only performance benefit is that the data will not be
|
|
copied from the JE cache to the application's entry parameter, and will
|
|
not be unmarshalled into an entity object.</p>
|
|
|
|
<p>For information on specifying isolation modes, see <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je"><code>LockMode</code></a>,
|
|
<a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je"><code>CursorConfig</code></a> and <a href="../../../com/sleepycat/je/TransactionConfig.html" title="class in com.sleepycat.je"><code>TransactionConfig</code></a>.</p>
|
|
<!-- end JE only --></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#keys-com.sleepycat.je.Transaction-K-boolean-K-boolean-com.sleepycat.je.CursorConfig-">keys</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>txn</code> - the transaction used to protect all operations performed with
|
|
the cursor, or null if the operations should not be transaction
|
|
protected. If the store is non-transactional, null must be specified.
|
|
For a transactional store the transaction is optional for read-only
|
|
access and required for read-write access.</dd>
|
|
<dd><code>fromKey</code> - is the lower bound of the key range, or null if the range
|
|
has no lower bound.</dd>
|
|
<dd><code>fromInclusive</code> - is true if keys greater than or equal to fromKey
|
|
should be included in the key range, or false if only keys greater than
|
|
fromKey should be included.</dd>
|
|
<dd><code>toKey</code> - is the upper bound of the key range, or null if the range
|
|
has no upper bound.</dd>
|
|
<dd><code>toInclusive</code> - is true if keys less than or equal to toKey should be
|
|
included in the key range, or false if only keys less than toKey should
|
|
be included.</dd>
|
|
<dd><code>config</code> - the cursor configuration that determines the default lock
|
|
mode used for all cursor operations, or null to implicitly use <a href="../../../com/sleepycat/je/CursorConfig.html#DEFAULT"><code>CursorConfig.DEFAULT</code></a>.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the cursor.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="entities-java.lang.Object-boolean-java.lang.Object-boolean-">
|
|
<!-- -->
|
|
</a><a name="entities-K-boolean-K-boolean-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>entities</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><E> entities(K fromKey,
|
|
boolean fromInclusive,
|
|
K toKey,
|
|
boolean toInclusive)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#entities-K-boolean-K-boolean-">EntityIndex</a></code></span></div>
|
|
<div class="block">Opens a cursor for traversing entities in a key range.
|
|
|
|
<p>The operations performed with the cursor will not be transaction
|
|
protected, and <a href="../../../com/sleepycat/je/CursorConfig.html#DEFAULT"><code>CursorConfig.DEFAULT</code></a> is used implicitly. If the
|
|
store is transactional, the cursor may not be used to update or delete
|
|
entities.</p></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#entities-K-boolean-K-boolean-">entities</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>fromKey</code> - is the lower bound of the key range, or null if the range
|
|
has no lower bound.</dd>
|
|
<dd><code>fromInclusive</code> - is true if keys greater than or equal to fromKey
|
|
should be included in the key range, or false if only keys greater than
|
|
fromKey should be included.</dd>
|
|
<dd><code>toKey</code> - is the upper bound of the key range, or null if the range
|
|
has no upper bound.</dd>
|
|
<dd><code>toInclusive</code> - is true if keys less than or equal to toKey should be
|
|
included in the key range, or false if only keys less than toKey should
|
|
be included.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the cursor.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="entities-com.sleepycat.je.Transaction-java.lang.Object-boolean-java.lang.Object-boolean-com.sleepycat.je.CursorConfig-">
|
|
<!-- -->
|
|
</a><a name="entities-com.sleepycat.je.Transaction-K-boolean-K-boolean-com.sleepycat.je.CursorConfig-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>entities</h4>
|
|
<pre>public <a href="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</a><E> entities(<a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je">Transaction</a> txn,
|
|
K fromKey,
|
|
boolean fromInclusive,
|
|
K toKey,
|
|
boolean toInclusive,
|
|
<a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je">CursorConfig</a> config)
|
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../com/sleepycat/persist/EntityIndex.html#entities-com.sleepycat.je.Transaction-K-boolean-K-boolean-com.sleepycat.je.CursorConfig-">EntityIndex</a></code></span></div>
|
|
<div class="block">Opens a cursor for traversing entities in a key range.</div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/persist/EntityIndex.html#entities-com.sleepycat.je.Transaction-K-boolean-K-boolean-com.sleepycat.je.CursorConfig-">entities</a></code> in interface <code><a href="../../../com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</a><K,E></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>txn</code> - the transaction used to protect all operations performed with
|
|
the cursor, or null if the operations should not be transaction
|
|
protected. If the store is non-transactional, null must be specified.
|
|
For a transactional store the transaction is optional for read-only
|
|
access and required for read-write access.</dd>
|
|
<dd><code>fromKey</code> - is the lower bound of the key range, or null if the range
|
|
has no lower bound.</dd>
|
|
<dd><code>fromInclusive</code> - is true if keys greater than or equal to fromKey
|
|
should be included in the key range, or false if only keys greater than
|
|
fromKey should be included.</dd>
|
|
<dd><code>toKey</code> - is the upper bound of the key range, or null if the range
|
|
has no upper bound.</dd>
|
|
<dd><code>toInclusive</code> - is true if keys less than or equal to toKey should be
|
|
included in the key range, or false if only keys less than toKey should
|
|
be included.</dd>
|
|
<dd><code>config</code> - the cursor configuration that determines the default lock
|
|
mode used for all cursor operations, or null to implicitly use <a href="../../../com/sleepycat/je/CursorConfig.html#DEFAULT"><code>CursorConfig.DEFAULT</code></a>.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the cursor.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code> - the base class for all BDB exceptions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<div class="bottomNav"><a name="navbar.bottom">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.bottom.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/SecondaryIndex.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
<div class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
|
|
</div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../../com/sleepycat/persist/StoreConfig.html" title="class in com.sleepycat.persist"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?com/sleepycat/persist/SecondaryIndex.html" target="_top">Frames</a></li>
|
|
<li><a href="SecondaryIndex.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor.detail">Constr</a> | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.bottom">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
<p class="legalCopy"><small><font size=1>Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.</font> </small></p>
|
|
</body>
|
|
</html>
|