[DATAREDIS-925] Support secondary index for attribute with UUID type Created: 24/Jan/19  Updated: 01/Apr/19  Resolved: 27/Mar/19

Status: Closed
Project: Spring Data Redis
Component/s: Core
Affects Version/s: 2.1.4 (Lovelace SR4)
Fix Version/s: 2.1.6 (Lovelace SR6), 2.2 M3 (Moore)

Type: Bug Priority: Major
Reporter: Ben Assignee: Christoph Strobl
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Last updater: Oliver Drotbohm
Pull Request URL: https://github.com/spring-projects/spring-data-redis/pull/444
Sprint: Lovelace SR1


I have defined a object model such as "person" to include a field "tenant" as UUID type, I want to annotate with "Indexed" so I can query person by tenant

public class Person implements Serializable {
   String id;

   UUID tenant;

   String email;

I added two persons by calling PersonRepository.save(person) with the same tenant UUID with different email.

Then I have following repository that defines two custom queries where first query using tenant (UUID) return empty (I expected two) while second query using email return one person that is expected.

@Repository public interface PersonRespository extends CrudRepository<Person, String>

{ List<Person> findByTenantAndEmail(UUID tenant, String email); //return empty List<Person> findByEmail(String email);//this one works fine }

It looks like framework does not index UUID type as I found out through debugging that PathIndexResolver will try to index UUID.mostSigBits  and UUID.leastSigBits.

I was able to workaround that by handling UUID type handling inside PathIndexResolver#Set<IndexedData> doResolveIndexesFor(..), but that method is private and I have to copy the code block in the extended class. I wonder if you can make the following enhancement:

  1. Support UUID for secondary index inside the framework
  2. or make PathIndexResolver#Set<IndexedData> doResolveIndexesFor(..) method protected instead of private so developer can handle custom object when dealing with secondary index.

Comment by Mark Paluch [ 27/Mar/19 ]

We added converters for UUID to binary conversions and vice versa.

Generated at Sat Jul 04 18:30:29 UTC 2020 using Jira 8.5.4#805004-sha1:0444eab799707f9ad7b248d69f858774aadfd250.