Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>David Segleau, Director of Product Management for Berkeley DB here. Generally, we recommend that people ask questions on the Berkeley DB forums. You'll find a large community of active Berkeley DB application developers there. </p> <p>The short answer to your question is that Berkeley DB has auto-increment services available. You just have to decide how you want to use them. Those options include:</p> <ol> <li>Put the code in your application. Since BDB is a library and it's linked into your application, many people simply control auto-increment key generation within the application itself. Of course, this can be somewhat more complicated if you are developing a multi-threaded or multi-process application. </li> <li>Use the a Berkeley DB Sequence to manage auto-increment. If you are using the basic Key/Value Pair API or the Collections API (as in your case), you can create a BDB Sequence, call the appropriate routines in order to get the next value and then assign that value to the key before writing the record. Since BDB Sequences are transactionally protected and function across a BDB environment, any multi-threading or multi-process issues are taken care of by the BDB library. You can find more information about BDB Sequences in chapter 19 of the BDB Reference Guide and in the <a href="http://bit.ly/efyGGS" rel="nofollow">Java API Programmers Reference Guide</a>.</li> <li>If you are using the DPL (Direct Persistence Layer) API, you can define the primary key as a sequence. The DPL will then automatically take care of incrementing the key value during a put() operation. </li> </ol> <p>I hope that was helpful. </p> <p>Regards, </p> <p>Dave</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload