Coder Social home page Coder Social logo

Issue with @Unindexed Annotation on java.util.Collections in Spring Data Cloud Datastore - Not Working as Expected about spring-cloud-gcp HOT 6 CLOSED

Rajkumar061299 avatar Rajkumar061299 commented on July 18, 2024
Issue with @Unindexed Annotation on java.util.Collections in Spring Data Cloud Datastore - Not Working as Expected

from spring-cloud-gcp.

Comments (6)

meltsufin avatar meltsufin commented on July 18, 2024

I think this is a valid issue.
Some context for investigation: spring-attic/spring-cloud-gcp#1832.

from spring-cloud-gcp.

burkedavison avatar burkedavison commented on July 18, 2024

Hello @Rajkumar061299 , can you clarify what is the behavior you're seeing with Objectify that you're expecting with the Spring Cloud GCP Data Datastore module?

When I have a entity defined like this:

@Entity
public class ObjectifyLibrary {
  @Id private String id = UUID.randomUUID().toString();
  @Unindex private String primitive;
  @Unindex private Set<String> collectionOfPrimitive;
  @Unindex private Map<String, String> mapOfPrimitives;
  @Unindex private ObjectifyBook ref;
  @Unindex private List<ObjectifyBook> refs;
  @Unindex private Map<String, ObjectifyBook> mapOfRefs;

The resulting entity in the console looks like this:
image

The above matches the current behavior of Spring Cloud GCP Data Datastore, when I modify an existing example of the have the same set of field types:
image

In an attempt to see what would happen, I modified the logic to mark the list or map as "exclude from indexes", I get an error from the server:

com.google.datastore.v1.client.DatastoreException: Exclude from indexes cannot be set on a list value
    at com.google.datastore.v1.client.RemoteRpc.makeException(RemoteRpc.java:184) ~[datastore-v1-proto-client-2.18.5.jar:2.18.5]

So based on the above, I am not currently seeing a difference in behavior, and I also don't see that there's an available modification to the way the library is marking "exclude from indexes" given that it would result in an exception.

from spring-cloud-gcp.

Rajkumar061299 avatar Rajkumar061299 commented on July 18, 2024

Hi @burkedavison, I was trying to Unindex the map in Objectify version 5.1.22, and it got unindexed properly.

import com.googlecode.objectify.annotation.*;
import java.io.Serializable;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

import lombok.Data;

@Entity
@Index
@Data public class Library implements Serializable {
  @Id private String id = UUID.randomUUID().toString();
  @Unindex private Map<String, Set<String>> attributes;
}
Screenshot 2024-04-06 at 12 50 05 PM

Could you please share the GitHub link for the Objectify example you tried?

from spring-cloud-gcp.

burkedavison avatar burkedavison commented on July 18, 2024

Here's the example I was using - now updated to also have a Map<String, Set>:
https://github.com/burkedavison/objectify-datastore-example/tree/main

I'm still getting the same behavior - not what you're seeing in your screenshot.
image

from spring-cloud-gcp.

Rajkumar061299 avatar Rajkumar061299 commented on July 18, 2024

Hi @burkedavison , In our application, we are currently using Objectify version 5.1.22, which allows us to Unindex lists or sets of objects, as well as maps. However, after further investigation, we discovered that newer versions of Objectify and Google Datastore client libraries do not support these types. Thank you for your assistance with this issue. We can close this issue.

from spring-cloud-gcp.

burkedavison avatar burkedavison commented on July 18, 2024

Sounds good - thank you for your patience and best wishes on your application.

from spring-cloud-gcp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.