You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given Parent references a Child via @LazyReference.
Retrieve the parent, then access the child.
Make a modification to only the child and then attempt to save the child.
An error results:
error on save here: com.google.cloud.spring.data.datastore.core.mapping.DatastoreDataException: Cloud Datastore can only allocate IDs for Long and Key properties.
Cannot allocate for type: class java.lang.String
Thanks for reporting this, I was able to reproduce this issue and it looks like to me that writing/updating an entity that's lazy referenced is not supported in the code base as of now. We'll look into this bug a bit more.
In the meantime, a less ideal temporary workaround is to do a copy of this retrievedChild and saving this copy instead. Something similar to this for your sample code:
Describe the bug
Given Parent references a Child via @LazyReference.
Retrieve the parent, then access the child.
Make a modification to only the child and then attempt to save the child.
An error results:
error on save here: com.google.cloud.spring.data.datastore.core.mapping.DatastoreDataException: Cloud Datastore can only allocate IDs for Long and Key properties.
Cannot allocate for type: class java.lang.String
Sample
https://github.com/mmihira/spring-datastore-reference-example
The test is below.
The text was updated successfully, but these errors were encountered: