Home > Blockchain >  Google Cloud Datastore/Objectify: are there any drawbacks of using EmbeddedEntity over direct serial
Google Cloud Datastore/Objectify: are there any drawbacks of using EmbeddedEntity over direct serial

Time:03-21

I am trying to store a map object in Java to Google Cloud Datastore. What are the disadvantages of treating it as EmbeddedEntity compared to directly using @Serizalize on the field?

CodePudding user response:

We are using an EmbeddedEntity-based approach extensively in a large application and it works just fine, I really can't name any disadvantage.

I would generally avoid using Java serialization where possible, it can become really cumbersome if you try to update the 'schema' of the objects you store there.

CodePudding user response:

The embedded entities can be indexed and based on the index you can query on subproperties. If you exclude an embedded entity from indexing, then all subproperties are also excluded from indexing. To know more about embedded entities you can go through this document.

With serializable objects the blob values are not indexed and hence can not be used in query filters and sort orders. To know more about serializable objects you can go through this document.

So there is no disadvantage as such while using embedded entities and it is better to use embedded entities as it provides an additional feature over serialization of having the option of index based querying.

  • Related