How do you plan to use the HashMap? You won't be able to query on it, so if
that's a requirement, you'll want to look into adding another relationship.

- Jason

On Fri, Sep 4, 2009 at 7:14 PM, Sam Walker <am.sam.wal...@gmail.com> wrote:

> Thanks!
>
> I am thinking of doing something like this:
>
> class Article {
>   HashSet<Key> reviewers;
>   HashSet<String> tags;
>   int status; // pending, approved, declined - derived from reviewers'
> statuses
>
>   HashMap<Key, Review> mapping; // Reviewer key to Review mapping to
> prevent storing making another 1:n relationship
>
>   class Review {
>     int status; // pending, approved, declined
>     String notes;
>     ... // anything else
>   }
> }
>
> Do you think this will work? It doesn't get me all the things I want, but
> is still good enough I think (its kind of sad that we can't model this
> common scenario effectively/efficiently).
>
> Do you recommend doing this HashMap kind of a hacky thing or just make a
> new Entity and a new relationship? Is it worth the saving?
>
>
> On Sat, Aug 29, 2009 at 12:28 AM, leszek <leszek.ptokar...@gmail.com>wrote:
>
>>
>> Let consider a different approach. Take into account that Article and
>> Reviewer are rather immutable data (you need adding new article but
>> not to change existing), why break this nice feature.
>> Consider several classes:
>> Article { Key , {tags} .... next attribuites }
>> Reviewer { Key, mail, ... next attributes }
>> ArticleNotReviewedYet { Key articleKey }
>> ArticleUnderReview { Key articleKey, Key reviewerKey, int
>> reviewResult }
>> ArticleReviewed {Key articleKey, int totalReviewResult }
>>
>> This way if you want:
>> - to know the status of the article : find article in the first table
>> and find (by looking up the articleKey only) in what table
>> (ArticleNotReviewed, ArticleUnderReview, ArticleReviewed) contains the
>> articleKey
>> - to add new article: add article to Article and entry to
>> ArticleNotReviewed
>> - to start review: remove article from ArticleNotReviewed and add an
>> entry in ArticleUnderReview
>> - to add next review result: add next entry to ArticleUnderReview
>> - to end up review: remove all articleKey entries in
>> ArticleUnderReview and create entry in ArticleReviewed
>>
>>
>> Of course, it needs much more elaboration, but may be it is worth
>> considering.
>>
>>
>>
>
> >
>

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