Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when persisting List values with indexing turned off #101

Closed
sai-pullabhotla opened this issue Feb 4, 2017 · 1 comment
Closed
Assignees
Milestone

Comments

@sai-pullabhotla
Copy link
Owner

Email from a developer:

I made quite a bit of progress migrating my app from GAE (with Objectify) to GCE (with Catatumbo) thanks to your great library.
One thing I stumbled upon was that using the annotation to unindex a property on a list resulted in an exception while persisting the entity:

@Property(indexed = false)
private List<String> myList;

Caused by: com.google.cloud.datastore.DatastoreException: Exclude from indexes cannot be set on a list value
	at com.google.cloud.datastore.spi.DefaultDatastoreRpc.translate(DefaultDatastoreRpc.java:110)
	at com.google.cloud.datastore.spi.DefaultDatastoreRpc.commit(DefaultDatastoreRpc.java:137)
	at com.google.cloud.datastore.DatastoreImpl$4.call(DatastoreImpl.java:390)
	at com.google.cloud.datastore.DatastoreImpl$4.call(DatastoreImpl.java:387)
	at com.google.cloud.RetryHelper.doRetry(RetryHelper.java:179)
	at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:244)
	at com.google.cloud.datastore.DatastoreImpl.commit(DatastoreImpl.java:386)
	at com.google.cloud.datastore.DatastoreImpl.commitMutation(DatastoreImpl.java:380)
	at com.google.cloud.datastore.DatastoreImpl.update(DatastoreImpl.java:309)
	at com.jmethods.catatumbo.impl.DefaultDatastoreWriter.update(DefaultDatastoreWriter.java:168)
	... 60 more

I found a thread about this issue and it looks like as if you could fix this by excluding each value in the list from the index:

"The Cloud Datastore API currently requires that each individual value in the list sets excludeFromIndexes(true)."

googleapis/google-cloud-java#158

Could you please have a look at it? It would be great to see this issue disappearing.

@sai-pullabhotla
Copy link
Owner Author

This was kind of unusual that that the Datastore mandates the List/Array properties to be always indexed. Made some refactoring to the Mappers API and updated the ListMapper and SetMapper accordingly. These changes took away the ability to override default mappers for List/Set types, for now. Need to revisit this if there is really a need for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant