Meliovation
Meliovation

Reputation: 360

Google App Engine Datastore Viewer How to Create Entity and Set String @Id (key) Field

I have a data model class where the String field "customerUniqueId" is tagged using Objectify annotation @Id. Therefore I am using a string key field (not auto-number long) that I set in code when creating a new object to put to the data store.

@Id private String customerUniqueId;

While using the Datastore Viewer to view these objects, I can click the Create tab to create a new object. However the "customerUniqueId" field is not offered as an input field. I am only shown the fields tagged as @Indexed in my data model.

Is this expected behavior or should I be able to input a value for the @Id field in the Datastore Viewer Create feature?

Am I using @Id incorrectly and must I name the field as "id" or "name"?

Perhaps if I tag the @Id field as also @Indexed but that should be unnecessary right? @Id fields should always be indexed be definition.

Perhaps it has something to do with the "Namespace" textboxes in the Create form that I left blank?

Anyone have this issue and know of a solution? Thanks!

Upvotes: 0

Views: 704

Answers (1)

stickfigure
stickfigure

Reputation: 13556

The @Id field does not exist as a property in the datastore. It is part of the entity's key. I don't think the datastore viewer lets you create an entity with a String key; it always uses the autogenerated number. Perhaps file an issue with Google against the datastore viewer?

Upvotes: 1

Related Questions