Is there a way to get only the length (in bytes) of a value stored in BDB? I don't need the entire data array, only its size.
If you don't want to have to retrieve the entire entry and aren't using DPL, I'd say you should add a secondary index on the size of the stored byte array and make sure that your DAO properly updates this value on any save or updates. You could add a KeyCreator
which creates a secondary size
key in a secondary database based on the record.
What type of query are you trying to perform? Are you wanted to search for all records of a given size? Or are you wanting to know the size of a certain record before you retrieve it? I think the latter question is harder to answer.