Q: autonicrement berkeley db, or list Do berkeley db has autoincrement?
I'm using java for testing, 
I saw the example: collections.ship.tuple.Sample where the author uses a StoredSortedMap to handle the data, so he needs to put a key every time.
I'd like to know if the Berkeley has autoincrement stuff.
Or if there is a kind of list to be stored and retrieved...

A: 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. 
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:


*

*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. 

*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 Java API Programmers Reference Guide.

*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. 


I hope that was helpful. 
Regards, 
Dave
