This content has been marked as final. Show 2 replies
I'm wondering if I should be able to retrieve entities using a DiskOrderedCursor (for optimal read performance) and deserialize them back to my custom entity objects.Yes, you can.
I've tried using the Bind API (even though I did not use it to serialize the objects on insert), but I get the following error. Is there a better method for this?You have the right idea but the problem is that you're using the SerialBinding, which is not the binding used to by the DPL. You can get the DPL's bindings from the DPL itself. See the "Low Level Access" section here:
Low Level Access
Each Direct Persistence Layer index is associated with an underlying Database or SecondaryDatabase defined in the Base API. At this level, an index is a Btree managed by the Berkeley DB Java Edition transactional storage engine. Although you may never need to work at the Base API level, keep in mind that some types of performance tuning can be done by configuring the underlying databases. See the EntityStore class for more information on database and sequence configuration.
If you wish to access an index using the Base API, you may call the PrimaryIndex.getDatabase() or SecondaryIndex.getDatabase() method to get the underlying database. To translate between entity or key objects and DatabaseEntry objects at this level, use the bindings returned by PrimaryIndex.getEntityBinding(), PrimaryIndex.getKeyBinding(), and SecondaryIndex.getKeyBinding().