# Getting null data from Aerospike in case of Spring data

**URL:** <https://discuss.aerospike.com/t/getting-null-data-from-aerospike-in-case-of-spring-data/5391>\
**Category:** How Aerospike Works\
**Tags:** java, index\
**Created:** [July 27, 2018, 5:59am UTC](https://discuss.aerospike.com/t/getting-null-data-from-aerospike-in-case-of-spring-data/5391 "2018-07-27T05:59:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shashank](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shashank](https://discuss.aerospike.com/u/shashank)\
**Post date:** [July 27, 2018, 5:59am UTC](https://discuss.aerospike.com/t/getting-null-data-from-aerospike-in-case-of-spring-data/5391/1 "2018-07-27T05:59:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Albot](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/albot/32/2076_2.png) [@Albot](https://discuss.aerospike.com/u/Albot)\
**Post date:** [July 28, 2018, 2:17am UTC](https://discuss.aerospike.com/t/getting-null-data-from-aerospike-in-case-of-spring-data/5391/2 "2018-07-28T02:17:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [July 28, 2018, 3:44am UTC](https://discuss.aerospike.com/t/getting-null-data-from-aerospike-in-case-of-spring-data/5391/3 "2018-07-28T03:44:57Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![shashank](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shashank](https://discuss.aerospike.com/u/shashank)\
**Post date:** [August 29, 2018, 7:36am UTC](https://discuss.aerospike.com/t/getting-null-data-from-aerospike-in-case-of-spring-data/5391/4 "2018-08-29T07:36:41Z")

</div>

@pguptaDoesn’t help.

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.
