Getting null data from Aerospike in case of Spring data

java
index

#1

I have created an application which is inserting data into aerospike via 2 modes :

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

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


#2

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


#3

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 https://github.com/spring-projects/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.