We've been utilising Objectify for data persistence in Google Cloud Datastore, where the @Unindex annotation works seamlessly across all value types. However, upon transitioning to Spring Cloud Data Datastore, we expected similar functionality. Unfortunately, we've encountered an issue where @Unindex annotations within Map or List<Ref<?>> fields are not producing the expected outcome.
Environment Details:
Java 17 Spring Boot 3.2.3 Gradle 8.5
build.gradle
ext {
set('springCloudGcpVersion', "5.0.4")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.google.cloud:spring-cloud-gcp-starter'
implementation 'com.google.cloud:spring-cloud-gcp-starter-data-datastore'
}
dependencyManagement {
imports {
mavenBom "com.google.cloud:spring-cloud-gcp-dependencies:${springCloudGcpVersion}"
}
}
Entity Classes:
import com.google.cloud.spring.data.datastore.core.mapping.*;
import org.springframework.data.annotation.Id;
@Entity(name = "Library")
public class Library {
@Id private String id = UUID.randomUUID().toString();
@Unindexed private Map<String, Set<String>> attributes; // Unsuccessful unindexing
@Unindexed private Set<Integer> sets; // Successfully unindexed
@Unindexed @LazyReference private List<Book> bookRefs; // Unsuccessful unindexing
}
import com.google.cloud.datastore.Key;
import com.google.cloud.spring.data.datastore.core.mapping.*;
import org.springframework.data.annotation.Id;
@Entity
public class Book {
@Id Key id;
private String title;
}
We're seeking resolution to ensure consistent @Unindexing functionality across all relevant data types within Spring Cloud Data Datastore.
Any lead will be appreciated.
Thanks!