In the Google Cloud Datastore API, Entities are immutable. I appreciate the value of immutability, but this means that every time I set a property, I must again build -- i.e., copy -- the entire Entity, which is very inefficient. It makes the simple act of setting N property values into O(N^2).
The alternative is to save property values in my own entity data structure, then copy this to the API's Entity right before saving, and again from the API's Entity to my own right after querying or getting it.
Or else I could use the Builder to store mutable state and only build an Entity right before saving; when I get or query an entity, I would take the Builder from that Entity.
Am I misunderstanding something? Is there a way to do this efficiently?
(I am using Java.)