I have a question about the best practice for storing/manipulating data for writing into and reading out of Aerospike.
I use the Java Client, and our app is written in Java 1.7.
My goal is to create a generic way of writing, reading an querying data so it may be used around the application
My original design was to take my POJO, for example a Person class with a name and surname field, convert that to JSON and store it in the database as a Bin as a String and visa versa for a read.
Subsequently I have read through your documentation and you say it is best practice not to write JSON as a plain string, which makes sense when you do queries on Bins etc.
I am now changing the code to save these POJO’s properties/fields as individual bins, in a generic way.
name = Johnny surname = Jones
I think I will store this class as follows in a record:
Bin1 = name, "Johnny" Bin2 = surname, "Jones" Bin3 = json, (person class coverted to JSON string)
This should allow me to: Key/Value queries without returning JSON and then processing it Get straight JSON from db to send to Rest Service immediately JSON Bin allowing a simple conversion from Aerospike back into Java POJO for business logic.
Is this a good pattern, or have you seen better solution for this problem of simple and efficient conversion from Java Object to Bins and back?