Hi Hans. Aside from the article on modeling entity relationships and the JDO
documentation, there aren't a lot of resources on http://code.google.com on
this subject, which is something we'll try to address going forward. You may
be able to find blog posts from other developers on this, but it's a
generally hard topic to write about in the abstract since needs vary so much
from app to app. I'm happy to help with specific questions you might have.

It sounds like you want to add a new kind (as opposed to a new property for
an existing kind) and establish a relationship with this new kind
(FundingOrganization) and an existing kind (Campaign). For many-to-many
relationships such as this, one approach you can take is similar to what you
might do for an RDBMS schema: introduce a new table (kind) to model the
relationship between FundingOrganization and Campaign entities. This third
kind would have only two properties, one storing a FundingOrganization Key
and the other a Campaign Key, then you can use it to query for all
FundingOrganization entities associated with a given Campaign and vice
versa. This approach doesn't require you to modify your Campaign kind at
all, so you don't necessarily need to make it aware of the
FundingOrganization kind, which was one of your requirements.

Let me know if this answers your question or if you have any other
questions.

- Jason

On Thu, Oct 29, 2009 at 1:55 PM, Hans <[email protected]> wrote:

>
> Hoping someone might help me with a somewhat OT question.
>
> I developed an object model for a GAE/J application that worked fairly
> well for awhile (and it was fun watching how easy it was to persist
> the instances to the datastore). But now I need to extend the model.
> Each "Campaign" instance I use needs to be related (many-to-many) with
> new "FundingOrganization" instances. I'm suspecting there may be other
> similar extensions I'll need to make to the model after the fact
> (additional categories associated with the Campaign).
>
> I can think of approaches to refactoring the application that include
> changing the Campaign class to know about FundingOrganization (http://
> code.google.com/appengine/docs/java/datastore/
> relationships.html#Unowned_Relationships), but I'd prefer to keep the
> entities pretty simple without adding a property for each new category
> that comes up.
>
> Can someone point this rookie to intro material/URLs for building and
> refactoring designs that lend themselves to these type of changes? I'm
> looking for info on adaptable design, especially when you're using a
> datastore and not using a RDBMS, junction tables, etc.
>
> thanks,
> Hans
> >
>

--~--~---------~--~----~------------~-------~--~----~
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