I have created an application which is inserting data into aerospike via 2 modes :
- I have used aerospike client to insert the data.
I am passing the keys in it, saving the bin.
My key is : 12345
Username : 12345
This is getting saved.
I didnt specify the @Id property here, as it is not a spring-hibernate project.
- I have created another application for reading and writing from aerospike on top of Spring boot + spring data.
I dont have any @Id property in the entity class.
When I am trying to save object over here using the aerospike repository. It is throwing me error to create an @Id property.
When I create the @Id property, I get all the object’s data, but the @Id column is null if it is inserted from the 1st case (from the aerospike client).
It works fine it it was inserted via 2nd application.
Help me resolve this issue.
Are you using spring connector? I feel like I’m missing something here… maybe it’s because I don’t know what a spring hibernation is
AFAIK @Entity and @Id annotations apply when using a SQL table store. (Part of ORM - Object to Relational Model). @Id identifies the primary key of the table. (Foreign key is @ManyToOne – if I recall correctly.) So depends on what repository he is using that applies these annotations to Aerospike. Wondering if these are part of GitHub - spring-attic/spring-data-aerospike: Spring Data Aerospike ? Regardless, the issue can be that while @Id identifies the primary key, we know Aerospike does not store the primary key but a hash of it. So he may have to add the same data also as a bin separately again.
I tried using the digest generated by the Key object.
First of all, it generates a encoded string “8�RPj� ��J��ͅ9���” .
Secondly, when I am reading the data for this, it is able to encode the data, but I am still getting that particular field as null.