spring-data-aerospike icon indicating copy to clipboard operation
spring-data-aerospike copied to clipboard

Using projection with repository.findById()

Open william-harris opened this issue 2 years ago • 3 comments

Hello, I am unable to use projections together with repository.findById() Please see here for my setup: https://github.com/william-harris/aerospike-projection

The two tests that use findById() are failing.

william-harris avatar Aug 10 '23 09:08 william-harris

Hello @william-harris!

Thanks for inquiry. First of all, using repository "findById" queries with projection will be included in the next release 4.4.0 (coming soon). Secondly, in your Person object there is no need to annotate id field as @Field and @Indexed (after all, you have not added the id field to the projection class PersonName anyway). The @Id annotation means that it is actually not a regular field but a special id property, so @Id var id: Long?, is correct.

agrgr avatar Aug 10 '23 15:08 agrgr

Thank you for the clarification. I added those annotations because I got errors when they were omitted. Might I suggest throwing an UnsupportedOperationException in the future when callers attempt to do something which isn't supported?

william-harris avatar Aug 11 '23 06:08 william-harris

Thanks @william-harris, we will consider your feedback. Did you get a chance to use findById with projections? By the way, you can check the newest release of Spring Data Aerospike.

agrgr avatar Dec 19 '23 17:12 agrgr

Closed due to inactivity.

reugn avatar Jun 05 '24 13:06 reugn