1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<!--NewPage--> 3<HTML> 4<HEAD> 5<!-- Generated by javadoc (build 1.5.0) on Thu May 15 17:17:33 EDT 2008 --> 6<TITLE> 7PrimaryIndex (Oracle - Berkeley DB Java API) 8</TITLE> 9 10<META NAME="keywords" CONTENT="com.sleepycat.persist.PrimaryIndex class"> 11 12<LINK REL ="stylesheet" TYPE="text/css" HREF="/style.css" TITLE="Style"> 13 14<SCRIPT type="text/javascript"> 15function windowTitle() 16{ 17 parent.document.title="PrimaryIndex (Oracle - Berkeley DB Java API)"; 18} 19</SCRIPT> 20<NOSCRIPT> 21</NOSCRIPT> 22 23</HEAD> 24 25<BODY BGCOLOR="white" onload="windowTitle();"> 26 27 28<!-- ========= START OF TOP NAVBAR ======= --> 29<A NAME="navbar_top"><!-- --></A> 30<A HREF="#skip-navbar_top" title="Skip navigation links"></A> 31<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 32<TR> 33<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 34<A NAME="navbar_top_firstrow"><!-- --></A> 35<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 36 <TR ALIGN="center" VALIGN="top"> 37 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/PrimaryIndex.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 45 </TR> 46</TABLE> 47</TD> 48<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 49<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM> 50</TD> 51</TR> 52 53<TR> 54<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 55 <A HREF="/com/sleepycat/persist/ForwardCursor.html" title="interface in com.sleepycat.persist"><B>PREV CLASS</B></A> 56 <A HREF="/com/sleepycat/persist/SecondaryIndex.html" title="class in com.sleepycat.persist"><B>NEXT CLASS</B></A></FONT></TD> 57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 58 <A HREF="/index.html?com/sleepycat/persist/PrimaryIndex.html" target="_top"><B>FRAMES</B></A> 59 <A HREF="PrimaryIndex.html" target="_top"><B>NO FRAMES</B></A> 60 <SCRIPT type="text/javascript"> 61 <!-- 62 if(window==top) { 63 document.writeln('<A HREF="/allclasses-noframe.html"><B>All Classes</B></A>'); 64 } 65 //--> 66</SCRIPT> 67<NOSCRIPT> 68 <A HREF="/allclasses-noframe.html"><B>All Classes</B></A> 69</NOSCRIPT> 70 71 72</FONT></TD> 73</TR> 74<TR> 75<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 76 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 77<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 78DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 79</TR> 80</TABLE> 81<A NAME="skip-navbar_top"></A> 82<!-- ========= END OF TOP NAVBAR ========= --> 83 84<HR> 85<!-- ======== START OF CLASS DATA ======== --> 86<H2> 87<FONT SIZE="-1"> 88com.sleepycat.persist</FONT> 89<BR> 90Class PrimaryIndex<PK,E></H2> 91<PRE> 92<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A> 93 <IMG SRC="/resources/inherit.gif" ALT="extended by "><B>com.sleepycat.persist.PrimaryIndex<PK,E></B> 94</PRE> 95<DL> 96<DT><B>All Implemented Interfaces:</B> <DD><A HREF="/com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist">EntityIndex</A><PK,E></DD> 97</DL> 98<HR> 99<DL> 100<DT><PRE>public class <B>PrimaryIndex<PK,E></B><DT>extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL> 101</PRE> 102 103<P> 104The primary index for an entity class and its primary key. 105 106 <p><code>PrimaryIndex</code> objects are thread-safe. Multiple threads may 107 safely call the methods of a shared <code>PrimaryIndex</code> object.</p> 108 109 <p><code>PrimaryIndex</code> implements <A HREF="/com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist"><CODE>EntityIndex</CODE></A> to map the primary 110 key type (PK) to the entity type (E).</p> 111 112 <p>The <A HREF="/com/sleepycat/persist/model/Entity.html" title="annotation in com.sleepycat.persist.model"><CODE>Entity</CODE></A> annotation may be used to define an entity class and 113 the <A HREF="/com/sleepycat/persist/model/PrimaryKey.html" title="annotation in com.sleepycat.persist.model"><CODE>PrimaryKey</CODE></A> annotation may be used to define a primary key as 114 shown in the following example.</p> 115 116 <pre class="code"> 117 @Entity 118 class Employee { 119 120 @PrimaryKey 121 long id; 122 123 String name; 124 125 Employee(long id, String name) { 126 this.id = id; 127 this.name = name; 128 } 129 130 private Employee() {} // For bindings 131 }</pre> 132 133 <p>To obtain the <code>PrimaryIndex</code> for a given entity class, call <A HREF="/com/sleepycat/persist/EntityStore.html#getPrimaryIndex(java.lang.Class, java.lang.Class)"><CODE>EntityStore.getPrimaryIndex</CODE></A>, passing the 134 primary key class and the entity class. For example:</p> 135 136 <pre class="code"> 137 EntityStore store = new EntityStore(...); 138 139 <code>PrimaryIndex<Long,Employee></code> primaryIndex = 140 store.getPrimaryIndex(Long.class, Employee.class);</pre> 141 </pre> 142 143 <p>Note that <code>Long.class</code> is passed as the primary key class, but the 144 primary key field has the primitive type <code>long</code>. When a primitive 145 primary key field is used, the corresponding primitive wrapper class is used 146 to access the primary index. For more information on key field types, see 147 <A HREF="/com/sleepycat/persist/model/PrimaryKey.html" title="annotation in com.sleepycat.persist.model"><CODE>PrimaryKey</CODE></A>.</p> 148 149 <p>The <code>PrimaryIndex</code> provides the primary storage and access methods 150 for the instances of a particular entity class. Entities are inserted and 151 updated in the <code>PrimaryIndex</code> by calling a method in the family of 152 <A HREF="/com/sleepycat/persist/PrimaryIndex.html#put(E)"><CODE>put(E)</CODE></A> methods. The <A HREF="/com/sleepycat/persist/PrimaryIndex.html#put(E)"><CODE>put(E)</CODE></A> method will insert the entity if no 153 entity with the same primary key already exists. If an entity with the same 154 primary key does exist, it will update the entity and return the existing 155 (old) entity. For example:</p> 156 157 <pre class="code"> 158 Employee oldEntity; 159 oldEntity = primaryIndex.put(new Employee(1, "Jane Smith")); // Inserts an entity 160 assert oldEntity == null; 161 oldEntity = primaryIndex.put(new Employee(2, "Joan Smith")); // Inserts an entity 162 assert oldEntity == null; 163 oldEntity = primaryIndex.put(new Employee(2, "Joan M. Smith")); // Updates an entity 164 assert oldEntity != null;</pre> 165 166 <p>The <A HREF="/com/sleepycat/persist/PrimaryIndex.html#putNoReturn(E)"><CODE>putNoReturn(E)</CODE></A> method can be used to avoid the overhead of 167 returning the existing entity, when the existing entity is not important to 168 the application. The return type of <A HREF="/com/sleepycat/persist/PrimaryIndex.html#putNoReturn(E)"><CODE>putNoReturn(E)</CODE></A> is void. For 169 example:</p> 170 171 <pre class="code"> 172 primaryIndex.putNoReturn(new Employee(1, "Jane Smith")); // Inserts an entity 173 primaryIndex.putNoReturn(new Employee(2, "Joan Smith")); // Inserts an entity 174 primaryIndex.putNoReturn(new Employee(2, "Joan M. Smith")); // Updates an entity</pre> 175 176 <p>The <A HREF="/com/sleepycat/persist/PrimaryIndex.html#putNoOverwrite(E)"><CODE>putNoOverwrite(E)</CODE></A> method can be used to ensure that an existing 177 entity is not overwritten. <A HREF="/com/sleepycat/persist/PrimaryIndex.html#putNoOverwrite(E)"><CODE>putNoOverwrite(E)</CODE></A> returns true if the 178 entity was inserted, or false if an existing entity exists and no action was 179 taken. For example:<p> 180 181 <pre class="code"> 182 boolean inserted; 183 inserted = primaryIndex.putNoOverwrite(new Employee(1, "Jane Smith")); // Inserts an entity 184 assert inserted; 185 inserted = primaryIndex.putNoOverwrite(new Employee(2, "Joan Smith")); // Inserts an entity 186 assert inserted; 187 inserted = primaryIndex.putNoOverwrite(new Employee(2, "Joan M. Smith")); // <strong>No action was taken!</strong> 188 assert !inserted;</pre> 189 190 <p>Primary key values must be unique, in other words, each instance of a 191 given entity class must have a distinct primary key value. Rather than 192 assigning the unique primary key values yourself, a <em>sequence</em> can be 193 used to assign sequential integer values automatically, starting with the 194 value 1 (one). A sequence is defined using the <A HREF="/com/sleepycat/persist/model/PrimaryKey.html#sequence()"><CODE>PrimaryKey.sequence()</CODE></A> 195 annotation property. For example:</p> 196 197 <pre class="code"> 198 @Entity 199 class Employee { 200 201 @PrimaryKey(sequence="ID") 202 long id; 203 204 String name; 205 206 Employee(String name) { 207 this.name = name; 208 } 209 210 private Employee() {} // For bindings 211 }</pre> 212 213 <p>The name of the sequence used above is "ID". Any name can be used. If 214 the same sequence name is used in more than one entity class, the sequence 215 will be shared by those classes, in other words, a single sequence of 216 integers will be used for all instances of those classes. See <A HREF="/com/sleepycat/persist/model/PrimaryKey.html#sequence()"><CODE>PrimaryKey.sequence()</CODE></A> for more information.</p> 217 218 <p>Any method in the family of <A HREF="/com/sleepycat/persist/PrimaryIndex.html#put(E)"><CODE>put(E)</CODE></A> methods may be used to insert 219 entities where the primary key is assigned from a sequence. When the <A HREF="/com/sleepycat/persist/PrimaryIndex.html#put(E)"><CODE>put(E)</CODE></A> method returns, the primary key field of the entity object will be set 220 to the assigned key value. For example:</p> 221 222 <pre class="code"> 223 Employee employee; 224 employee = new Employee("Jane Smith"); 225 primaryIndex.putNoReturn(employee); // Inserts an entity 226 assert employee.id == 1; 227 employee = new Employee("Joan Smith"); 228 primaryIndex.putNoReturn(employee); // Inserts an entity 229 assert employee.id == 2;</pre> 230 231 <p>This begs the question: How do you update an existing entity, without 232 assigning a new primary key? The answer is that the <A HREF="/com/sleepycat/persist/PrimaryIndex.html#put(E)"><CODE>put(E)</CODE></A> methods 233 will only assign a new key from the sequence if the primary key field is 234 zero or null (for reference types). If an entity with a non-zero and 235 non-null key field is passed to a <A HREF="/com/sleepycat/persist/PrimaryIndex.html#put(E)"><CODE>put(E)</CODE></A> method, any existing entity 236 with that primary key value will be updated. For example:</p> 237 238 <pre class="code"> 239 Employee employee; 240 employee = new Employee("Jane Smith"); 241 primaryIndex.putNoReturn(employee); // Inserts an entity 242 assert employee.id == 1; 243 employee = new Employee("Joan Smith"); 244 primaryIndex.putNoReturn(employee); // Inserts an entity 245 assert employee.id == 2; 246 employee.name = "Joan M. Smith"; 247 primaryIndex.putNoReturn(employee); // Updates an existing entity 248 assert employee.id == 2;</pre> 249 250 <p>Since <code>PrimaryIndex</code> implements the <A HREF="/com/sleepycat/persist/EntityIndex.html" title="interface in com.sleepycat.persist"><CODE>EntityIndex</CODE></A> interface, 251 it shares the common index methods for retrieving and deleting entities, 252 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 253 information on these topics.</p> 254 255 <p>Note that when using an index, keys and values are stored and retrieved 256 by value not by reference. In other words, if an entity object is stored 257 and then retrieved, or retrieved twice, each object will be a separate 258 instance. For example, in the code below the assertion will always 259 fail.</p> 260 <pre class="code"> 261 MyKey key = ...; 262 MyEntity entity1 = new MyEntity(key, ...); 263 index.put(entity1); 264 MyEntity entity2 = index.get(key); 265 assert entity1 == entity2; // always fails! 266 </pre> 267<P> 268 269<P> 270<HR> 271 272<P> 273 274<!-- ======== CONSTRUCTOR SUMMARY ======== --> 275 276<A NAME="constructor_summary"><!-- --></A> 277<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 278<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 279<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 280<B>Constructor Summary</B></FONT></TH> 281</TR> 282<TR BGCOLOR="white" CLASS="TableRowColor"> 283<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#PrimaryIndex(com.sleepycat.db.Database, java.lang.Class, com.sleepycat.bind.EntryBinding, java.lang.Class, com.sleepycat.bind.EntityBinding)">PrimaryIndex</A></B>(<A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db">Database</A> database, 284 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A>> keyClass, 285 <A HREF="/com/sleepycat/bind/EntryBinding.html" title="interface in com.sleepycat.bind">EntryBinding</A> keyBinding, 286 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A>> entityClass, 287 <A HREF="/com/sleepycat/bind/EntityBinding.html" title="interface in com.sleepycat.bind">EntityBinding</A> entityBinding)</CODE> 288 289<BR> 290 Creates a primary index without using an <code>EntityStore</code>.</TD> 291</TR> 292</TABLE> 293 294<!-- ========== METHOD SUMMARY =========== --> 295 296<A NAME="method_summary"><!-- --></A> 297<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 298<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 299<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 300<B>Method Summary</B></FONT></TH> 301</TR> 302<TR BGCOLOR="white" CLASS="TableRowColor"> 303<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 304<CODE> boolean</CODE></FONT></TD> 305<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#contains(K)">contains</A></B>(K key)</CODE> 306 307<BR> 308 Checks for existence of a key in this index.</TD> 309</TR> 310<TR BGCOLOR="white" CLASS="TableRowColor"> 311<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 312<CODE> boolean</CODE></FONT></TD> 313<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#contains(com.sleepycat.db.Transaction, K, com.sleepycat.db.LockMode)">contains</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 314 K key, 315 <A HREF="/com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</A> lockMode)</CODE> 316 317<BR> 318 Checks for existence of a key in this index.</TD> 319</TR> 320<TR BGCOLOR="white" CLASS="TableRowColor"> 321<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 322<CODE> long</CODE></FONT></TD> 323<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#count()">count</A></B>()</CODE> 324 325<BR> 326 Returns a non-transactional count of the entities in this index.</TD> 327</TR> 328<TR BGCOLOR="white" CLASS="TableRowColor"> 329<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 330<CODE> boolean</CODE></FONT></TD> 331<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#delete(K)">delete</A></B>(K key)</CODE> 332 333<BR> 334 Deletes all entities with a given index key.</TD> 335</TR> 336<TR BGCOLOR="white" CLASS="TableRowColor"> 337<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 338<CODE> boolean</CODE></FONT></TD> 339<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#delete(com.sleepycat.db.Transaction, K)">delete</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 340 K key)</CODE> 341 342<BR> 343 Deletes all entities with a given index key.</TD> 344</TR> 345<TR BGCOLOR="white" CLASS="TableRowColor"> 346<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 347<CODE> <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><E></CODE></FONT></TD> 348<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#entities()">entities</A></B>()</CODE> 349 350<BR> 351 Opens a cursor for traversing all entities in this index.</TD> 352</TR> 353<TR BGCOLOR="white" CLASS="TableRowColor"> 354<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 355<CODE> <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><E></CODE></FONT></TD> 356<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#entities(K, boolean, K, boolean)">entities</A></B>(K fromKey, 357 boolean fromInclusive, 358 K toKey, 359 boolean toInclusive)</CODE> 360 361<BR> 362 Opens a cursor for traversing entities in a key range.</TD> 363</TR> 364<TR BGCOLOR="white" CLASS="TableRowColor"> 365<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 366<CODE> <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><E></CODE></FONT></TD> 367<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#entities(com.sleepycat.db.Transaction, com.sleepycat.db.CursorConfig)">entities</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 368 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db">CursorConfig</A> config)</CODE> 369 370<BR> 371 Opens a cursor for traversing all entities in this index.</TD> 372</TR> 373<TR BGCOLOR="white" CLASS="TableRowColor"> 374<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 375<CODE> <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><E></CODE></FONT></TD> 376<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#entities(com.sleepycat.db.Transaction, K, boolean, K, boolean, com.sleepycat.db.CursorConfig)">entities</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 377 K fromKey, 378 boolean fromInclusive, 379 K toKey, 380 boolean toInclusive, 381 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db">CursorConfig</A> config)</CODE> 382 383<BR> 384 Opens a cursor for traversing entities in a key range.</TD> 385</TR> 386<TR BGCOLOR="white" CLASS="TableRowColor"> 387<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 388<CODE> <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A></CODE></FONT></TD> 389<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#get(PK)">get</A></B>(<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A> key)</CODE> 390 391<BR> 392 Gets an entity via a key of this index.</TD> 393</TR> 394<TR BGCOLOR="white" CLASS="TableRowColor"> 395<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 396<CODE> <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A></CODE></FONT></TD> 397<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#get(com.sleepycat.db.Transaction, PK, com.sleepycat.db.LockMode)">get</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 398 <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A> key, 399 <A HREF="/com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</A> lockMode)</CODE> 400 401<BR> 402 Gets an entity via a key of this index.</TD> 403</TR> 404<TR BGCOLOR="white" CLASS="TableRowColor"> 405<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 406<CODE> <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db">Database</A></CODE></FONT></TD> 407<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#getDatabase()">getDatabase</A></B>()</CODE> 408 409<BR> 410 Returns the underlying database for this index.</TD> 411</TR> 412<TR BGCOLOR="white" CLASS="TableRowColor"> 413<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 414<CODE> <A HREF="/com/sleepycat/bind/EntityBinding.html" title="interface in com.sleepycat.bind">EntityBinding</A></CODE></FONT></TD> 415<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#getEntityBinding()">getEntityBinding</A></B>()</CODE> 416 417<BR> 418 Returns the entity binding for this index.</TD> 419</TR> 420<TR BGCOLOR="white" CLASS="TableRowColor"> 421<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 422<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A>></CODE></FONT></TD> 423<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#getEntityClass()">getEntityClass</A></B>()</CODE> 424 425<BR> 426 Returns the entity class for this index.</TD> 427</TR> 428<TR BGCOLOR="white" CLASS="TableRowColor"> 429<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 430<CODE> <A HREF="/com/sleepycat/bind/EntryBinding.html" title="interface in com.sleepycat.bind">EntryBinding</A></CODE></FONT></TD> 431<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#getKeyBinding()">getKeyBinding</A></B>()</CODE> 432 433<BR> 434 Returns the primary key binding for this index.</TD> 435</TR> 436<TR BGCOLOR="white" CLASS="TableRowColor"> 437<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 438<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A>></CODE></FONT></TD> 439<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#getKeyClass()">getKeyClass</A></B>()</CODE> 440 441<BR> 442 Returns the primary key class for this index.</TD> 443</TR> 444<TR BGCOLOR="white" CLASS="TableRowColor"> 445<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 446<CODE> <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><K></CODE></FONT></TD> 447<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#keys()">keys</A></B>()</CODE> 448 449<BR> 450 Opens a cursor for traversing all keys in this index.</TD> 451</TR> 452<TR BGCOLOR="white" CLASS="TableRowColor"> 453<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 454<CODE> <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><K></CODE></FONT></TD> 455<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#keys(K, boolean, K, boolean)">keys</A></B>(K fromKey, 456 boolean fromInclusive, 457 K toKey, 458 boolean toInclusive)</CODE> 459 460<BR> 461 Opens a cursor for traversing keys in a key range.</TD> 462</TR> 463<TR BGCOLOR="white" CLASS="TableRowColor"> 464<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 465<CODE> <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><K></CODE></FONT></TD> 466<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#keys(com.sleepycat.db.Transaction, com.sleepycat.db.CursorConfig)">keys</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 467 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db">CursorConfig</A> config)</CODE> 468 469<BR> 470 Opens a cursor for traversing all keys in this index.</TD> 471</TR> 472<TR BGCOLOR="white" CLASS="TableRowColor"> 473<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 474<CODE> <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><K></CODE></FONT></TD> 475<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#keys(com.sleepycat.db.Transaction, K, boolean, K, boolean, com.sleepycat.db.CursorConfig)">keys</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 476 K fromKey, 477 boolean fromInclusive, 478 K toKey, 479 boolean toInclusive, 480 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db">CursorConfig</A> config)</CODE> 481 482<BR> 483 Opens a cursor for traversing keys in a key range.</TD> 484</TR> 485<TR BGCOLOR="white" CLASS="TableRowColor"> 486<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 487<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A>,<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A>></CODE></FONT></TD> 488<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#map()">map</A></B>()</CODE> 489 490<BR> 491 Returns a standard Java map based on this entity index.</TD> 492</TR> 493<TR BGCOLOR="white" CLASS="TableRowColor"> 494<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 495<CODE> <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A></CODE></FONT></TD> 496<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#put(E)">put</A></B>(<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity)</CODE> 497 498<BR> 499 Inserts an entity and returns null, or updates it if the primary key 500 already exists and returns the existing entity.</TD> 501</TR> 502<TR BGCOLOR="white" CLASS="TableRowColor"> 503<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 504<CODE> <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A></CODE></FONT></TD> 505<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#put(com.sleepycat.db.Transaction, E)">put</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 506 <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity)</CODE> 507 508<BR> 509 Inserts an entity and returns null, or updates it if the primary key 510 already exists and returns the existing entity.</TD> 511</TR> 512<TR BGCOLOR="white" CLASS="TableRowColor"> 513<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 514<CODE> boolean</CODE></FONT></TD> 515<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#putNoOverwrite(E)">putNoOverwrite</A></B>(<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity)</CODE> 516 517<BR> 518 Inserts an entity and returns true, or returns false if the primary key 519 already exists.</TD> 520</TR> 521<TR BGCOLOR="white" CLASS="TableRowColor"> 522<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 523<CODE> boolean</CODE></FONT></TD> 524<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#putNoOverwrite(com.sleepycat.db.Transaction, E)">putNoOverwrite</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 525 <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity)</CODE> 526 527<BR> 528 Inserts an entity and returns true, or returns false if the primary key 529 already exists.</TD> 530</TR> 531<TR BGCOLOR="white" CLASS="TableRowColor"> 532<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 533<CODE> void</CODE></FONT></TD> 534<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#putNoReturn(E)">putNoReturn</A></B>(<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity)</CODE> 535 536<BR> 537 Inserts an entity, or updates it if the primary key already exists (does 538 not return the existing entity).</TD> 539</TR> 540<TR BGCOLOR="white" CLASS="TableRowColor"> 541<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 542<CODE> void</CODE></FONT></TD> 543<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#putNoReturn(com.sleepycat.db.Transaction, E)">putNoReturn</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 544 <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity)</CODE> 545 546<BR> 547 Inserts an entity, or updates it if the primary key already exists (does 548 not return the existing entity).</TD> 549</TR> 550<TR BGCOLOR="white" CLASS="TableRowColor"> 551<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 552<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/SortedMap.html" title="class or interface in java.util">SortedMap</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A>,<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A>></CODE></FONT></TD> 553<TD><CODE><B><A HREF="/com/sleepycat/persist/PrimaryIndex.html#sortedMap()">sortedMap</A></B>()</CODE> 554 555<BR> 556 Returns a standard Java sorted map based on this entity index.</TD> 557</TR> 558</TABLE> 559 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 560<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 561<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 562<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH> 563</TR> 564<TR BGCOLOR="white" CLASS="TableRowColor"> 565<TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> 566</TR> 567</TABLE> 568 569<P> 570 571<!-- ========= CONSTRUCTOR DETAIL ======== --> 572 573<A NAME="constructor_detail"><!-- --></A> 574<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 575<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 576<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 577<B>Constructor Detail</B></FONT></TH> 578</TR> 579</TABLE> 580 581<A NAME="PrimaryIndex(com.sleepycat.db.Database, java.lang.Class, com.sleepycat.bind.EntryBinding, java.lang.Class, com.sleepycat.bind.EntityBinding)"><!-- --></A><H3> 582PrimaryIndex</H3> 583<PRE> 584public <B>PrimaryIndex</B>(<A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db">Database</A> database, 585 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A>> keyClass, 586 <A HREF="/com/sleepycat/bind/EntryBinding.html" title="interface in com.sleepycat.bind">EntryBinding</A> keyBinding, 587 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A>> entityClass, 588 <A HREF="/com/sleepycat/bind/EntityBinding.html" title="interface in com.sleepycat.bind">EntityBinding</A> entityBinding) 589 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 590<DL> 591<DD>Creates a primary index without using an <code>EntityStore</code>. 592 593 <p>This constructor is not normally needed and is provided for 594 applications that wish to use custom bindings along with the Direct 595 Persistence Layer. Normally, <A HREF="/com/sleepycat/persist/EntityStore.html#getPrimaryIndex(java.lang.Class, java.lang.Class)"><CODE>getPrimaryIndex</CODE></A> is used instead.</p> 596 597 <p>Note that when this constructor is used directly, primary keys cannot 598 be automatically assigned from a sequence. The key assignment feature 599 requires knowledge of the primary key field, which is only available if 600 an <code>EntityStore</code> is used. Of course, primary keys may be 601 assigned from a sequence manually before calling the <code>put</code> 602 methods in this class.</p> 603<P> 604<DL> 605<DT><B>Parameters:</B><DD><CODE>database</CODE> - the primary database.<DD><CODE>keyClass</CODE> - the class of the primary key.<DD><CODE>keyBinding</CODE> - the binding to be used for primary keys.<DD><CODE>entityClass</CODE> - the class of the entities stored in this index.<DD><CODE>entityBinding</CODE> - the binding to be used for entities. 606<DT><B>Throws:</B> 607<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 608</DL> 609 610<!-- ============ METHOD DETAIL ========== --> 611 612<A NAME="method_detail"><!-- --></A> 613<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 614<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 615<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 616<B>Method Detail</B></FONT></TH> 617</TR> 618</TABLE> 619 620<A NAME="getDatabase()"><!-- --></A><H3> 621getDatabase</H3> 622<PRE> 623public <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db">Database</A> <B>getDatabase</B>()</PRE> 624<DL> 625<DD>Returns the underlying database for this index. 626<P> 627<DD><DL> 628 629<DT><B>Returns:</B><DD>the database.</DL> 630</DD> 631</DL> 632<HR> 633 634<A NAME="getKeyClass()"><!-- --></A><H3> 635getKeyClass</H3> 636<PRE> 637public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A>> <B>getKeyClass</B>()</PRE> 638<DL> 639<DD>Returns the primary key class for this index. 640<P> 641<DD><DL> 642 643<DT><B>Returns:</B><DD>the key class.</DL> 644</DD> 645</DL> 646<HR> 647 648<A NAME="getKeyBinding()"><!-- --></A><H3> 649getKeyBinding</H3> 650<PRE> 651public <A HREF="/com/sleepycat/bind/EntryBinding.html" title="interface in com.sleepycat.bind">EntryBinding</A> <B>getKeyBinding</B>()</PRE> 652<DL> 653<DD>Returns the primary key binding for this index. 654<P> 655<DD><DL> 656 657<DT><B>Returns:</B><DD>the key binding.</DL> 658</DD> 659</DL> 660<HR> 661 662<A NAME="getEntityClass()"><!-- --></A><H3> 663getEntityClass</H3> 664<PRE> 665public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A>> <B>getEntityClass</B>()</PRE> 666<DL> 667<DD>Returns the entity class for this index. 668<P> 669<DD><DL> 670 671<DT><B>Returns:</B><DD>the entity class.</DL> 672</DD> 673</DL> 674<HR> 675 676<A NAME="getEntityBinding()"><!-- --></A><H3> 677getEntityBinding</H3> 678<PRE> 679public <A HREF="/com/sleepycat/bind/EntityBinding.html" title="interface in com.sleepycat.bind">EntityBinding</A> <B>getEntityBinding</B>()</PRE> 680<DL> 681<DD>Returns the entity binding for this index. 682<P> 683<DD><DL> 684 685<DT><B>Returns:</B><DD>the entity binding.</DL> 686</DD> 687</DL> 688<HR> 689 690<A NAME="put(java.lang.Object)"><!-- --></A><A NAME="put(E)"><!-- --></A><H3> 691put</H3> 692<PRE> 693public <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> <B>put</B>(<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity) 694 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 695<DL> 696<DD>Inserts an entity and returns null, or updates it if the primary key 697 already exists and returns the existing entity. 698 699 <p>If a <A HREF="/com/sleepycat/persist/model/PrimaryKey.html#sequence()"><CODE>PrimaryKey.sequence()</CODE></A> is used and the primary key field of 700 the given entity is null or zero, this method will assign the next value 701 from the sequence to the primary key field of the given entity.</p> 702 703 <p>Auto-commit is used implicitly if the store is transactional.</p> 704<P> 705<DD><DL> 706<DT><B>Parameters:</B><DD><CODE>entity</CODE> - the entity to be inserted or updated. 707<DT><B>Returns:</B><DD>the existing entity that was updated, or null if the entity was 708 inserted. 709<DT><B>Throws:</B> 710<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 711</DD> 712</DL> 713<HR> 714 715<A NAME="put(com.sleepycat.db.Transaction,java.lang.Object)"><!-- --></A><A NAME="put(com.sleepycat.db.Transaction, E)"><!-- --></A><H3> 716put</H3> 717<PRE> 718public <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> <B>put</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 719 <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity) 720 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 721<DL> 722<DD>Inserts an entity and returns null, or updates it if the primary key 723 already exists and returns the existing entity. 724 725 <p>If a <A HREF="/com/sleepycat/persist/model/PrimaryKey.html#sequence()"><CODE>PrimaryKey.sequence()</CODE></A> is used and the primary key field of 726 the given entity is null or zero, this method will assign the next value 727 from the sequence to the primary key field of the given entity.</p> 728<P> 729<DD><DL> 730<DT><B>Parameters:</B><DD><CODE>txn</CODE> - the transaction used to protect this operation, null to use 731 auto-commit, or null if the store is non-transactional.<DD><CODE>entity</CODE> - the entity to be inserted or updated. 732<DT><B>Returns:</B><DD>the existing entity that was updated, or null if the entity was 733 inserted. 734<DT><B>Throws:</B> 735<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 736</DD> 737</DL> 738<HR> 739 740<A NAME="putNoReturn(java.lang.Object)"><!-- --></A><A NAME="putNoReturn(E)"><!-- --></A><H3> 741putNoReturn</H3> 742<PRE> 743public void <B>putNoReturn</B>(<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity) 744 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 745<DL> 746<DD>Inserts an entity, or updates it if the primary key already exists (does 747 not return the existing entity). This method may be used instead of 748 <A HREF="/com/sleepycat/persist/PrimaryIndex.html#put(E)"><CODE>put(Object)</CODE></A> to save the overhead of returning the existing 749 entity. 750 751 <p>If a <A HREF="/com/sleepycat/persist/model/PrimaryKey.html#sequence()"><CODE>PrimaryKey.sequence()</CODE></A> is used and the primary key field of 752 the given entity is null or zero, this method will assign the next value 753 from the sequence to the primary key field of the given entity.</p> 754 755 <p>Auto-commit is used implicitly if the store is transactional.</p> 756<P> 757<DD><DL> 758<DT><B>Parameters:</B><DD><CODE>entity</CODE> - the entity to be inserted or updated. 759<DT><B>Throws:</B> 760<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 761</DD> 762</DL> 763<HR> 764 765<A NAME="putNoReturn(com.sleepycat.db.Transaction,java.lang.Object)"><!-- --></A><A NAME="putNoReturn(com.sleepycat.db.Transaction, E)"><!-- --></A><H3> 766putNoReturn</H3> 767<PRE> 768public void <B>putNoReturn</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 769 <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity) 770 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 771<DL> 772<DD>Inserts an entity, or updates it if the primary key already exists (does 773 not return the existing entity). This method may be used instead of 774 <A HREF="/com/sleepycat/persist/PrimaryIndex.html#put(com.sleepycat.db.Transaction, E)"><CODE>put(Transaction,Object)</CODE></A> to save the overhead of returning the 775 existing entity. 776 777 <p>If a <A HREF="/com/sleepycat/persist/model/PrimaryKey.html#sequence()"><CODE>PrimaryKey.sequence()</CODE></A> is used and the primary key field of 778 the given entity is null or zero, this method will assign the next value 779 from the sequence to the primary key field of the given entity.</p> 780<P> 781<DD><DL> 782<DT><B>Parameters:</B><DD><CODE>txn</CODE> - the transaction used to protect this operation, null to use 783 auto-commit, or null if the store is non-transactional.<DD><CODE>entity</CODE> - the entity to be inserted or updated. 784<DT><B>Throws:</B> 785<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 786</DD> 787</DL> 788<HR> 789 790<A NAME="putNoOverwrite(java.lang.Object)"><!-- --></A><A NAME="putNoOverwrite(E)"><!-- --></A><H3> 791putNoOverwrite</H3> 792<PRE> 793public boolean <B>putNoOverwrite</B>(<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity) 794 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 795<DL> 796<DD>Inserts an entity and returns true, or returns false if the primary key 797 already exists. 798 799 <p>If a <A HREF="/com/sleepycat/persist/model/PrimaryKey.html#sequence()"><CODE>PrimaryKey.sequence()</CODE></A> is used and the primary key field of 800 the given entity is null or zero, this method will assign the next value 801 from the sequence to the primary key field of the given entity.</p> 802 803 <p>Auto-commit is used implicitly if the store is transactional.</p> 804<P> 805<DD><DL> 806<DT><B>Parameters:</B><DD><CODE>entity</CODE> - the entity to be inserted. 807<DT><B>Returns:</B><DD>true if the entity was inserted, or false if an entity with the 808 same primary key is already present. 809<DT><B>Throws:</B> 810<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 811</DD> 812</DL> 813<HR> 814 815<A NAME="putNoOverwrite(com.sleepycat.db.Transaction,java.lang.Object)"><!-- --></A><A NAME="putNoOverwrite(com.sleepycat.db.Transaction, E)"><!-- --></A><H3> 816putNoOverwrite</H3> 817<PRE> 818public boolean <B>putNoOverwrite</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 819 <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> entity) 820 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 821<DL> 822<DD>Inserts an entity and returns true, or returns false if the primary key 823 already exists. 824 825 <p>If a <A HREF="/com/sleepycat/persist/model/PrimaryKey.html#sequence()"><CODE>PrimaryKey.sequence()</CODE></A> is used and the primary key field of 826 the given entity is null or zero, this method will assign the next value 827 from the sequence to the primary key field of the given entity.</p> 828<P> 829<DD><DL> 830<DT><B>Parameters:</B><DD><CODE>txn</CODE> - the transaction used to protect this operation, null to use 831 auto-commit, or null if the store is non-transactional.<DD><CODE>entity</CODE> - the entity to be inserted. 832<DT><B>Returns:</B><DD>true if the entity was inserted, or false if an entity with the 833 same primary key is already present. 834<DT><B>Throws:</B> 835<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 836</DD> 837</DL> 838<HR> 839 840<A NAME="get(java.lang.Object)"><!-- --></A><A NAME="get(PK)"><!-- --></A><H3> 841get</H3> 842<PRE> 843public <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> <B>get</B>(<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A> key) 844 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 845<DL> 846<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#get(K)">EntityIndex</A></CODE></B></DD> 847<DD>Gets an entity via a key of this index. 848 849 <p>The operation will not be transaction protected, and <A HREF="/com/sleepycat/db/LockMode.html#DEFAULT"><CODE>LockMode.DEFAULT</CODE></A> is used implicitly.</p> 850<P> 851<DD><DL> 852<DT><B>Parameters:</B><DD><CODE>key</CODE> - the key to search for. 853<DT><B>Returns:</B><DD>the value mapped to the given key, or null if the key is not 854 present in the index. 855<DT><B>Throws:</B> 856<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 857</DD> 858</DL> 859<HR> 860 861<A NAME="get(com.sleepycat.db.Transaction,java.lang.Object,com.sleepycat.db.LockMode)"><!-- --></A><A NAME="get(com.sleepycat.db.Transaction, PK, com.sleepycat.db.LockMode)"><!-- --></A><H3> 862get</H3> 863<PRE> 864public <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A> <B>get</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 865 <A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A> key, 866 <A HREF="/com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</A> lockMode) 867 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 868<DL> 869<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#get(com.sleepycat.db.Transaction, K, com.sleepycat.db.LockMode)">EntityIndex</A></CODE></B></DD> 870<DD>Gets an entity via a key of this index. 871<P> 872<DD><DL> 873<DT><B>Parameters:</B><DD><CODE>txn</CODE> - the transaction used to protect this operation, or null 874 if the operation should not be transaction protected.<DD><CODE>key</CODE> - the key to search for.<DD><CODE>lockMode</CODE> - the lock mode to use for this operation, or null to 875 use <A HREF="/com/sleepycat/db/LockMode.html#DEFAULT"><CODE>LockMode.DEFAULT</CODE></A>. 876<DT><B>Returns:</B><DD>the value mapped to the given key, or null if the key is not 877 present in the index. 878<DT><B>Throws:</B> 879<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 880</DD> 881</DL> 882<HR> 883 884<A NAME="map()"><!-- --></A><H3> 885map</H3> 886<PRE> 887public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A>,<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A>> <B>map</B>()</PRE> 888<DL> 889<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#map()">EntityIndex</A></CODE></B></DD> 890<DD>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 891 to the standard Java collections framework interface. 892<P> 893<DD><DL> 894 895<DT><B>Returns:</B><DD>the map.</DL> 896</DD> 897</DL> 898<HR> 899 900<A NAME="sortedMap()"><!-- --></A><H3> 901sortedMap</H3> 902<PRE> 903public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/SortedMap.html" title="class or interface in java.util">SortedMap</A><<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">PK</A>,<A HREF="/com/sleepycat/persist/PrimaryIndex.html" title="type parameter in PrimaryIndex">E</A>> <B>sortedMap</B>()</PRE> 904<DL> 905<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#sortedMap()">EntityIndex</A></CODE></B></DD> 906<DD>Returns a standard Java sorted map based on this entity index. The 907 <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 908 to the standard Java collections framework interface. 909<P> 910<DD><DL> 911 912<DT><B>Returns:</B><DD>the map.</DL> 913</DD> 914</DL> 915<HR> 916 917<A NAME="contains(java.lang.Object)"><!-- --></A><A NAME="contains(K)"><!-- --></A><H3> 918contains</H3> 919<PRE> 920public boolean <B>contains</B>(K key) 921 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 922<DL> 923<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#contains(K)">EntityIndex</A></CODE></B></DD> 924<DD>Checks for existence of a key in this index. 925 926 <p>The operation will not be transaction protected, and <A HREF="/com/sleepycat/db/LockMode.html#DEFAULT"><CODE>LockMode.DEFAULT</CODE></A> is used implicitly.</p> 927<P> 928<DD><DL> 929<DT><B>Specified by:</B><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></DL> 930</DD> 931<DD><DL> 932<DT><B>Parameters:</B><DD><CODE>key</CODE> - the key to search for. 933<DT><B>Returns:</B><DD>whether the key exists in the index. 934<DT><B>Throws:</B> 935<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 936</DD> 937</DL> 938<HR> 939 940<A NAME="contains(com.sleepycat.db.Transaction,java.lang.Object,com.sleepycat.db.LockMode)"><!-- --></A><A NAME="contains(com.sleepycat.db.Transaction, K, com.sleepycat.db.LockMode)"><!-- --></A><H3> 941contains</H3> 942<PRE> 943public boolean <B>contains</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 944 K key, 945 <A HREF="/com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</A> lockMode) 946 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 947<DL> 948<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#contains(com.sleepycat.db.Transaction, K, com.sleepycat.db.LockMode)">EntityIndex</A></CODE></B></DD> 949<DD>Checks for existence of a key in this index. 950<P> 951<DD><DL> 952<DT><B>Specified by:</B><DD><CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#contains(com.sleepycat.db.Transaction, K, com.sleepycat.db.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></DL> 953</DD> 954<DD><DL> 955<DT><B>Parameters:</B><DD><CODE>txn</CODE> - the transaction used to protect this operation, or null 956 if the operation should not be transaction protected.<DD><CODE>key</CODE> - the key to search for.<DD><CODE>lockMode</CODE> - the lock mode to use for this operation, or null to 957 use <A HREF="/com/sleepycat/db/LockMode.html#DEFAULT"><CODE>LockMode.DEFAULT</CODE></A>. 958<DT><B>Returns:</B><DD>whether the key exists in the index. 959<DT><B>Throws:</B> 960<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 961</DD> 962</DL> 963<HR> 964 965<A NAME="count()"><!-- --></A><H3> 966count</H3> 967<PRE> 968public long <B>count</B>() 969 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 970<DL> 971<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#count()">EntityIndex</A></CODE></B></DD> 972<DD>Returns a non-transactional count of the entities in this index. 973 974 <p>This operation is faster than obtaining a count by scanning the index 975 manually, and will not perturb the current contents of the cache. 976 However, the count is not guaranteed to be accurate if there are 977 concurrent updates.</p> 978<P> 979<DD><DL> 980<DT><B>Specified by:</B><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></DL> 981</DD> 982<DD><DL> 983 984<DT><B>Returns:</B><DD>the number of entities in this index. 985<DT><B>Throws:</B> 986<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 987</DD> 988</DL> 989<HR> 990 991<A NAME="delete(java.lang.Object)"><!-- --></A><A NAME="delete(K)"><!-- --></A><H3> 992delete</H3> 993<PRE> 994public boolean <B>delete</B>(K key) 995 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 996<DL> 997<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#delete(K)">EntityIndex</A></CODE></B></DD> 998<DD>Deletes all entities with a given index key. 999 1000 <p>Auto-commit is used implicitly if the store is transactional.</p> 1001<P> 1002<DD><DL> 1003<DT><B>Specified by:</B><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></DL> 1004</DD> 1005<DD><DL> 1006<DT><B>Parameters:</B><DD><CODE>key</CODE> - the key to search for. 1007<DT><B>Returns:</B><DD>whether any entities were deleted. 1008<DT><B>Throws:</B> 1009<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 1010</DD> 1011</DL> 1012<HR> 1013 1014<A NAME="delete(com.sleepycat.db.Transaction,java.lang.Object)"><!-- --></A><A NAME="delete(com.sleepycat.db.Transaction, K)"><!-- --></A><H3> 1015delete</H3> 1016<PRE> 1017public boolean <B>delete</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1018 K key) 1019 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1020<DL> 1021<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#delete(com.sleepycat.db.Transaction, K)">EntityIndex</A></CODE></B></DD> 1022<DD>Deletes all entities with a given index key. 1023<P> 1024<DD><DL> 1025<DT><B>Specified by:</B><DD><CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#delete(com.sleepycat.db.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></DL> 1026</DD> 1027<DD><DL> 1028<DT><B>Parameters:</B><DD><CODE>txn</CODE> - the transaction used to protect this operation, null to use 1029 auto-commit, or null if the store is non-transactional.<DD><CODE>key</CODE> - the key to search for. 1030<DT><B>Returns:</B><DD>whether any entities were deleted. 1031<DT><B>Throws:</B> 1032<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 1033</DD> 1034</DL> 1035<HR> 1036 1037<A NAME="keys()"><!-- --></A><H3> 1038keys</H3> 1039<PRE> 1040public <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><K> <B>keys</B>() 1041 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1042<DL> 1043<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#keys()">EntityIndex</A></CODE></B></DD> 1044<DD>Opens a cursor for traversing all keys in this index. 1045 1046 <p>The operations performed with the cursor will not be transaction 1047 protected, and <A HREF="/com/sleepycat/db/CursorConfig.html#DEFAULT"><CODE>CursorConfig.DEFAULT</CODE></A> is used implicitly. If the 1048 store is transactional, the cursor may not be used to update or delete 1049 entities.</p> 1050<P> 1051<DD><DL> 1052<DT><B>Specified by:</B><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></DL> 1053</DD> 1054<DD><DL> 1055 1056<DT><B>Returns:</B><DD>the cursor. 1057<DT><B>Throws:</B> 1058<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 1059</DD> 1060</DL> 1061<HR> 1062 1063<A NAME="keys(com.sleepycat.db.Transaction, com.sleepycat.db.CursorConfig)"><!-- --></A><H3> 1064keys</H3> 1065<PRE> 1066public <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><K> <B>keys</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1067 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db">CursorConfig</A> config) 1068 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1069<DL> 1070<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#keys(com.sleepycat.db.Transaction, com.sleepycat.db.CursorConfig)">EntityIndex</A></CODE></B></DD> 1071<DD>Opens a cursor for traversing all keys in this index. 1072<P> 1073<DD><DL> 1074<DT><B>Specified by:</B><DD><CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#keys(com.sleepycat.db.Transaction, com.sleepycat.db.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></DL> 1075</DD> 1076<DD><DL> 1077<DT><B>Parameters:</B><DD><CODE>txn</CODE> - the transaction used to protect all operations performed with 1078 the cursor, or null if the operations should not be transaction 1079 protected. If null is specified and the store is transactional, the 1080 cursor may not be used to update or delete entities.<DD><CODE>config</CODE> - the cursor configuration that determines the default lock 1081 mode used for all cursor operations, or null to implicitly use <A HREF="/com/sleepycat/db/CursorConfig.html#DEFAULT"><CODE>CursorConfig.DEFAULT</CODE></A>. 1082<DT><B>Returns:</B><DD>the cursor. 1083<DT><B>Throws:</B> 1084<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 1085</DD> 1086</DL> 1087<HR> 1088 1089<A NAME="entities()"><!-- --></A><H3> 1090entities</H3> 1091<PRE> 1092public <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><E> <B>entities</B>() 1093 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1094<DL> 1095<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#entities()">EntityIndex</A></CODE></B></DD> 1096<DD>Opens a cursor for traversing all entities in this index. 1097 1098 <p>The operations performed with the cursor will not be transaction 1099 protected, and <A HREF="/com/sleepycat/db/CursorConfig.html#DEFAULT"><CODE>CursorConfig.DEFAULT</CODE></A> is used implicitly. If the 1100 store is transactional, the cursor may not be used to update or delete 1101 entities.</p> 1102<P> 1103<DD><DL> 1104<DT><B>Specified by:</B><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></DL> 1105</DD> 1106<DD><DL> 1107 1108<DT><B>Returns:</B><DD>the cursor. 1109<DT><B>Throws:</B> 1110<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 1111</DD> 1112</DL> 1113<HR> 1114 1115<A NAME="entities(com.sleepycat.db.Transaction, com.sleepycat.db.CursorConfig)"><!-- --></A><H3> 1116entities</H3> 1117<PRE> 1118public <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><E> <B>entities</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1119 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db">CursorConfig</A> config) 1120 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1121<DL> 1122<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#entities(com.sleepycat.db.Transaction, com.sleepycat.db.CursorConfig)">EntityIndex</A></CODE></B></DD> 1123<DD>Opens a cursor for traversing all entities in this index. 1124<P> 1125<DD><DL> 1126<DT><B>Specified by:</B><DD><CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#entities(com.sleepycat.db.Transaction, com.sleepycat.db.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></DL> 1127</DD> 1128<DD><DL> 1129<DT><B>Parameters:</B><DD><CODE>txn</CODE> - the transaction used to protect all operations performed with 1130 the cursor, or null if the operations should not be transaction 1131 protected. If null is specified and the store is transactional, the 1132 cursor may not be used to update or delete entities.<DD><CODE>config</CODE> - the cursor configuration that determines the default lock 1133 mode used for all cursor operations, or null to implicitly use <A HREF="/com/sleepycat/db/CursorConfig.html#DEFAULT"><CODE>CursorConfig.DEFAULT</CODE></A>. 1134<DT><B>Returns:</B><DD>the cursor. 1135<DT><B>Throws:</B> 1136<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 1137</DD> 1138</DL> 1139<HR> 1140 1141<A NAME="keys(java.lang.Object,boolean,java.lang.Object,boolean)"><!-- --></A><A NAME="keys(K, boolean, K, boolean)"><!-- --></A><H3> 1142keys</H3> 1143<PRE> 1144public <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><K> <B>keys</B>(K fromKey, 1145 boolean fromInclusive, 1146 K toKey, 1147 boolean toInclusive) 1148 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1149<DL> 1150<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#keys(K, boolean, K, boolean)">EntityIndex</A></CODE></B></DD> 1151<DD>Opens a cursor for traversing keys in a key range. 1152 1153 <p>The operations performed with the cursor will not be transaction 1154 protected, and <A HREF="/com/sleepycat/db/CursorConfig.html#DEFAULT"><CODE>CursorConfig.DEFAULT</CODE></A> is used implicitly. If the 1155 store is transactional, the cursor may not be used to update or delete 1156 entities.</p> 1157<P> 1158<DD><DL> 1159<DT><B>Specified by:</B><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></DL> 1160</DD> 1161<DD><DL> 1162<DT><B>Parameters:</B><DD><CODE>fromKey</CODE> - is the lower bound of the key range, or null if the range 1163 has no lower bound.<DD><CODE>fromInclusive</CODE> - is true if keys greater than or equal to fromKey 1164 should be included in the key range, or false if only keys greater than 1165 fromKey should be included.<DD><CODE>toKey</CODE> - is the upper bound of the key range, or null if the range 1166 has no upper bound.<DD><CODE>toInclusive</CODE> - is true if keys less than or equal to toKey should be 1167 included in the key range, or false if only keys less than toKey should 1168 be included. 1169<DT><B>Returns:</B><DD>the cursor. 1170<DT><B>Throws:</B> 1171<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 1172</DD> 1173</DL> 1174<HR> 1175 1176<A NAME="keys(com.sleepycat.db.Transaction,java.lang.Object,boolean,java.lang.Object,boolean,com.sleepycat.db.CursorConfig)"><!-- --></A><A NAME="keys(com.sleepycat.db.Transaction, K, boolean, K, boolean, com.sleepycat.db.CursorConfig)"><!-- --></A><H3> 1177keys</H3> 1178<PRE> 1179public <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><K> <B>keys</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1180 K fromKey, 1181 boolean fromInclusive, 1182 K toKey, 1183 boolean toInclusive, 1184 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db">CursorConfig</A> config) 1185 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1186<DL> 1187<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#keys(com.sleepycat.db.Transaction, K, boolean, K, boolean, com.sleepycat.db.CursorConfig)">EntityIndex</A></CODE></B></DD> 1188<DD>Opens a cursor for traversing keys in a key range. 1189<P> 1190<DD><DL> 1191<DT><B>Specified by:</B><DD><CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#keys(com.sleepycat.db.Transaction, K, boolean, K, boolean, com.sleepycat.db.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></DL> 1192</DD> 1193<DD><DL> 1194<DT><B>Parameters:</B><DD><CODE>txn</CODE> - the transaction used to protect all operations performed with 1195 the cursor, or null if the operations should not be transaction 1196 protected. If null is specified and the store is transactional, the 1197 cursor may not be used to update or delete entities.<DD><CODE>fromKey</CODE> - is the lower bound of the key range, or null if the range 1198 has no lower bound.<DD><CODE>fromInclusive</CODE> - is true if keys greater than or equal to fromKey 1199 should be included in the key range, or false if only keys greater than 1200 fromKey should be included.<DD><CODE>toKey</CODE> - is the upper bound of the key range, or null if the range 1201 has no upper bound.<DD><CODE>toInclusive</CODE> - is true if keys less than or equal to toKey should be 1202 included in the key range, or false if only keys less than toKey should 1203 be included.<DD><CODE>config</CODE> - the cursor configuration that determines the default lock 1204 mode used for all cursor operations, or null to implicitly use <A HREF="/com/sleepycat/db/CursorConfig.html#DEFAULT"><CODE>CursorConfig.DEFAULT</CODE></A>. 1205<DT><B>Returns:</B><DD>the cursor. 1206<DT><B>Throws:</B> 1207<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 1208</DD> 1209</DL> 1210<HR> 1211 1212<A NAME="entities(java.lang.Object,boolean,java.lang.Object,boolean)"><!-- --></A><A NAME="entities(K, boolean, K, boolean)"><!-- --></A><H3> 1213entities</H3> 1214<PRE> 1215public <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><E> <B>entities</B>(K fromKey, 1216 boolean fromInclusive, 1217 K toKey, 1218 boolean toInclusive) 1219 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1220<DL> 1221<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#entities(K, boolean, K, boolean)">EntityIndex</A></CODE></B></DD> 1222<DD>Opens a cursor for traversing entities in a key range. 1223 1224 <p>The operations performed with the cursor will not be transaction 1225 protected, and <A HREF="/com/sleepycat/db/CursorConfig.html#DEFAULT"><CODE>CursorConfig.DEFAULT</CODE></A> is used implicitly. If the 1226 store is transactional, the cursor may not be used to update or delete 1227 entities.</p> 1228<P> 1229<DD><DL> 1230<DT><B>Specified by:</B><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></DL> 1231</DD> 1232<DD><DL> 1233<DT><B>Parameters:</B><DD><CODE>fromKey</CODE> - is the lower bound of the key range, or null if the range 1234 has no lower bound.<DD><CODE>fromInclusive</CODE> - is true if keys greater than or equal to fromKey 1235 should be included in the key range, or false if only keys greater than 1236 fromKey should be included.<DD><CODE>toKey</CODE> - is the upper bound of the key range, or null if the range 1237 has no upper bound.<DD><CODE>toInclusive</CODE> - is true if keys less than or equal to toKey should be 1238 included in the key range, or false if only keys less than toKey should 1239 be included. 1240<DT><B>Returns:</B><DD>the cursor. 1241<DT><B>Throws:</B> 1242<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 1243</DD> 1244</DL> 1245<HR> 1246 1247<A NAME="entities(com.sleepycat.db.Transaction,java.lang.Object,boolean,java.lang.Object,boolean,com.sleepycat.db.CursorConfig)"><!-- --></A><A NAME="entities(com.sleepycat.db.Transaction, K, boolean, K, boolean, com.sleepycat.db.CursorConfig)"><!-- --></A><H3> 1248entities</H3> 1249<PRE> 1250public <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist">EntityCursor</A><E> <B>entities</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1251 K fromKey, 1252 boolean fromInclusive, 1253 K toKey, 1254 boolean toInclusive, 1255 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db">CursorConfig</A> config) 1256 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1257<DL> 1258<DD><B>Description copied from interface: <CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#entities(com.sleepycat.db.Transaction, K, boolean, K, boolean, com.sleepycat.db.CursorConfig)">EntityIndex</A></CODE></B></DD> 1259<DD>Opens a cursor for traversing entities in a key range. 1260<P> 1261<DD><DL> 1262<DT><B>Specified by:</B><DD><CODE><A HREF="/com/sleepycat/persist/EntityIndex.html#entities(com.sleepycat.db.Transaction, K, boolean, K, boolean, com.sleepycat.db.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></DL> 1263</DD> 1264<DD><DL> 1265<DT><B>Parameters:</B><DD><CODE>txn</CODE> - the transaction used to protect all operations performed with 1266 the cursor, or null if the operations should not be transaction 1267 protected. If null is specified and the store is transactional, the 1268 cursor may not be used to update or delete entities.<DD><CODE>fromKey</CODE> - is the lower bound of the key range, or null if the range 1269 has no lower bound.<DD><CODE>fromInclusive</CODE> - is true if keys greater than or equal to fromKey 1270 should be included in the key range, or false if only keys greater than 1271 fromKey should be included.<DD><CODE>toKey</CODE> - is the upper bound of the key range, or null if the range 1272 has no upper bound.<DD><CODE>toInclusive</CODE> - is true if keys less than or equal to toKey should be 1273 included in the key range, or false if only keys less than toKey should 1274 be included.<DD><CODE>config</CODE> - the cursor configuration that determines the default lock 1275 mode used for all cursor operations, or null to implicitly use <A HREF="/com/sleepycat/db/CursorConfig.html#DEFAULT"><CODE>CursorConfig.DEFAULT</CODE></A>. 1276<DT><B>Returns:</B><DD>the cursor. 1277<DT><B>Throws:</B> 1278<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 1279</DD> 1280</DL> 1281<!-- ========= END OF CLASS DATA ========= --> 1282<HR> 1283 1284 1285<!-- ======= START OF BOTTOM NAVBAR ====== --> 1286<A NAME="navbar_bottom"><!-- --></A> 1287<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 1288<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 1289<TR> 1290<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 1291<A NAME="navbar_bottom_firstrow"><!-- --></A> 1292<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 1293 <TR ALIGN="center" VALIGN="top"> 1294 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 1295 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 1296 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 1297 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/PrimaryIndex.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 1298 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 1299 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 1300 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 1301 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 1302 </TR> 1303</TABLE> 1304</TD> 1305<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 1306<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM> 1307</TD> 1308</TR> 1309 1310<TR> 1311<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 1312 <A HREF="/com/sleepycat/persist/ForwardCursor.html" title="interface in com.sleepycat.persist"><B>PREV CLASS</B></A> 1313 <A HREF="/com/sleepycat/persist/SecondaryIndex.html" title="class in com.sleepycat.persist"><B>NEXT CLASS</B></A></FONT></TD> 1314<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 1315 <A HREF="/index.html?com/sleepycat/persist/PrimaryIndex.html" target="_top"><B>FRAMES</B></A> 1316 <A HREF="PrimaryIndex.html" target="_top"><B>NO FRAMES</B></A> 1317 <SCRIPT type="text/javascript"> 1318 <!-- 1319 if(window==top) { 1320 document.writeln('<A HREF="/allclasses-noframe.html"><B>All Classes</B></A>'); 1321 } 1322 //--> 1323</SCRIPT> 1324<NOSCRIPT> 1325 <A HREF="/allclasses-noframe.html"><B>All Classes</B></A> 1326</NOSCRIPT> 1327 1328 1329</FONT></TD> 1330</TR> 1331<TR> 1332<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 1333 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 1334<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 1335DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 1336</TR> 1337</TABLE> 1338<A NAME="skip-navbar_bottom"></A> 1339<!-- ======== END OF BOTTOM NAVBAR ======= --> 1340 1341<HR> 1342<font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 1343</BODY> 1344</HTML> 1345