[appengine-java] Re: Model to Optimize Queries

2009-09-25 Thread Jason (Google)
As far as I can tell, your plan should work -- I don't think you're missing anything. Now that your design is set, I'm looking forward to hearing how the actual implementation goes. Let me know if you have any other questions. - Jason On Tue, Sep 22, 2009 at 10:10 PM, Sam Walker wrote: > Thanks

[appengine-java] Re: Model to Optimize Queries

2009-09-22 Thread Sam Walker
Thanks Jason, I realize that I wont be able to do transactions per say across the entity groups, and that the tasks can be run multiple times. With those two constraints in mind, I designed both of the tasks described above (running any of the two multiple times wont have any affect due to the stag

[appengine-java] Re: Model to Optimize Queries

2009-09-22 Thread Jason (Google)
Hi Sam. Based on your design above, I believe you're modeling an unowned relationship between articles and reviewers, which makes sense. Unfortunately, this means that you cannot use transactions, so you'll have to work around this. Also keep in mind that tasks may be executed multiple times so you

[appengine-java] Re: Model to Optimize Queries

2009-09-20 Thread Sam Walker
Yea, I dont need to query on it, that's why I thought maybe storing in a HashMap would save me an extra query. Lets not go that way for now and assume I make a new relationship: I have another question, I was wondering if I can use TaskQueue to achieve some sort of transactions across entities and

[appengine-java] Re: Model to Optimize Queries

2009-09-08 Thread Jason (Google)
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 wrote: > Thanks! > > I am thinking of doing something like this: > > class Article { > Has

[appengine-java] Re: Model to Optimize Queries

2009-09-04 Thread Sam Walker
Thanks! I am thinking of doing something like this: class Article { HashSet reviewers; HashSet tags; int status; // pending, approved, declined - derived from reviewers' statuses HashMap mapping; // Reviewer key to Review mapping to prevent storing making another 1:n relationship clas

[appengine-java] Re: Model to Optimize Queries

2009-08-29 Thread leszek
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 at

[appengine-java] Re: Model to Optimize Queries

2009-08-28 Thread Jason (Google)
This would work, although there is a lot of redundancy as you say. A couple of other ideas I have: - Include the article status field in the Review itself -- this will be redundant too, but at least you're only duplicating one field and not the entire object. When you update an article's

[appengine-java] Re: Model to Optimize Queries

2009-08-27 Thread Sam Walker
Sorry, let me write it down with keys just to make sure we are on the same page: Article { HashSet reviews; // Keys of reviews HashSet tags; int status; // derived from all Reviews' statuses. } Review { Key article; Key reviewer; int status; } Reviewer { String email; } Now, do yo

[appengine-java] Re: Model to Optimize Queries

2009-08-27 Thread Sam Walker
Yes, it is a key. I just wanted to make it obvious which Keys are involved. I read the Embedded class as well, its not what I want here I think. How would you model this scenario then? Both models I discussed in my original post have issues. On Thu, Aug 27, 2009 at 11:22 AM, Jason (Google) wrote:

[appengine-java] Re: Model to Optimize Queries

2009-08-27 Thread Jason (Google)
JDO supports syntax like article.status but App Engine's datastore doesn't support joins so you'll have to make article an embedded object in order to use the query as you have it below: http://code.google.com/appengine/docs/java/datastore/dataclasses.html#Embedded_Classes Also, how have you defin

[appengine-java] Re: Model to Optimize Queries

2009-08-25 Thread Sam Walker
Any ideas, anyone? On Sun, Aug 23, 2009 at 11:18 PM, Sam Walker wrote: > Also, I get this error: *Can only filter by properties of a sub-object if > the sub-object is embedded.* when I tried to access article while setting > a fitler: query.setFilter("reviewer == reviewerParam && article.status

[appengine-java] Re: Model to Optimize Queries

2009-08-23 Thread Sam Walker
Also, I get this error: *Can only filter by properties of a sub-object if the sub-object is embedded.* when I tried to access article while setting a fitler: query.setFilter("reviewer == reviewerParam && article.status = articleStatusParam"); What am I missing? On Sat, Aug 22, 2009 at 6:02 PM, S

[appengine-java] Re: Model to Optimize Queries

2009-08-22 Thread Sam Walker
In the second model, how will I find all Articles being reviewed by A and B? The only way I can think of is adding another derived field in Article: Article { HashSet reviews; HashSet reviewers; // keys of Reviewers to help the query "find all articles reviewed by A and B" HashSet tags; i

[appengine-java] Re: Model to Optimize Queries

2009-08-22 Thread Sam Walker
Oh sweet, I didn't know that. That's awesome! Thanks for the quick reply. On Sat, Aug 22, 2009 at 1:51 PM, datanucleus wrote: > > > I dont think I can do sth like (I can't access article.tags, > article.status > > as far as I know, correct?): > > Of course you can. JDO spec defines JDOQL, using

[appengine-java] Re: Model to Optimize Queries

2009-08-22 Thread datanucleus
> I dont think I can do sth like (I can't access article.tags, article.status > as far as I know, correct?): Of course you can. JDO spec defines JDOQL, using Java syntax. > query.setFilter("reviewer == reviewerParam && status == statusParam && > article.tags == tagParam && article.status = artic