On Tue, Jan 24, 2012 at 10:08 PM, Matthew Jaggard <matt...@jaggard.org.uk>wrote:

> Do you have any good reason to have separate classes rather than one big
> one with all the stuff that's in each?


Well, the reason is that I need to reuse class B. For example class A also
has a separate List<B> member.


> The main reason I ask is that loading two entities is about twice as
> expensive as loading one twice the size.


Tough. I cannot sacrifice code readability here.


> If you do have a good reason, you could still persist them as a single
> entity, but I'm not sure how to do this in JDO. In Objectify, you would
> just @Embed one class into the other.
>
> Mat.
>

Thank you for your reply.

Looking forward to hearing from someone who would know how to do this in
JDO.

Regards,

John Goche


>
> On 24 January 2012 20:05, John Goche <johngoch...@googlemail.com> wrote:
>
>>
>> Hello,
>>
>> I have the following classes in a unidirectional 1-1 relationship to each
>> other:
>>
>> class A {
>>
>>    B b;
>>
>>    // ... more fields
>>
>> }
>>
>> class B {
>>
>>   String k;
>>
>>   // ... more fields
>> }
>>
>> I want k to be the primary key for class B as well as for class A.
>> How do I accomplish this task? I've been told I need to implement
>> a PK class but don't understand why I would need one.
>>
>> Given I cannot find much information on the BigTable implementation
>> I don't even know how to think about the problem (I understand RDBMS
>> and think of each class as having its own table, although this may be
>> wrong).
>>
>> Thank you for your kind help,
>>
>> John Goche
>>
>> --
>> 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
>> google-appengine-java@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine-java+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>
>  --
> 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
> google-appengine-java@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to