I'm not an expert, but I believe I understand Objectify (and -- you
could post the query on their group as well, the owner is very
responsive and helpful).

The structure would more accurately have been described as:

@Entity
public class A {

private Long id;

@Embeded
private B child;

}

I don't know how big A & B are, and I don't know why you're trying to
conserve bandwidth -- but your #3 should work (but, requires an extra
trip to get an B associated with an A.

There's also a couple of ways of achieving it.  You could either
associate each B to an A by having a Key<A> in each B; or you could
have a Key<B> in each A.

I prefer this layout:


@Entity
public class A {

private Long id;

// Whatever else is in here
}

@Entity
public class B {

private Long id;

private Key<A> parent;
}

Your concerns about "dangling" relationships are concerns about the
GAE Datastore and its capabilities -- not about Objectify.  The GAE
requires that all logic to ensure these valid states must be
implemented in the application layer (its not a SQL DB).  If you're
really worried about that type of consistency, then using the B
embedded in A is the way to go.

Also -- its not true that you can't send less data to the client with
the A contains @Embedded B -- it just means that you would have to
create (and use) some sort of DTO that contained only the data that
you wanted to send to the client, and using that technique is likely
the simplest way for you to achieve your goals (I think).

Cheers
Mike

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to