Johnny Wu
Johnny Wu

Reputation: 1538

What's the benefit of using embedded Objectify class?

Does anyone know the benefit of using embedded class in Objectify? So far, my biggest problem with the embedded class is that I can't access outside of the entity or out of the App Engine Endpoint class. Just wondering.

Upvotes: 0

Views: 119

Answers (1)

Andrei Volgin
Andrei Volgin

Reputation: 41099

Using embedded entities saves you from making additional calls to the Datastore.

For example, you may store users' phone numbers as embedded entities in a User entity. This is a good option if you always need phone numbers when you retrieve users. This way if your query returns 100 user entities, you don't have to make 100+ calls to the Datastore to retrieve their phone numbers.

However, if you need to access these numbers separately, or be able search by phone number, a better option is to keep them as separate entities.

Upvotes: 1

Related Questions