Re: [appengine-java] Date, Calendar question (multiple instances of web application behaviour) clarification

2010-07-21 Thread Hariharan Anantharaman
Hi,

Perhaps not directly related to your question. But java.util.Date is mostly
deprecated and it is advised to use Calendar API. I believe that is
synchronized.


Thanks
Hari

2010/7/22 Ikai L (Google) 

> It should just be whatever the date is on the current instance. In general,
> do not ever rely on dates to be synchronized. Clock skew is a reality of
> distributed computing, and you'll have to work around it. What exactly is
> the problem you're trying to solve?
>
>
> On Sun, Jul 18, 2010 at 11:23 PM, Marcus Brody  wrote:
>
>> Good day,
>>
>> I would like to ask about following.
>>
>> How is java.util.Date synchronized in case there is more than 1
>> instance of my web application.
>> Example:
>>
>> WebAppInstance01 : I create somewhere new Date()
>>
>> at the same time
>> WebAppInstance02: I create somewhere  new Date()
>>
>> Is there some time shift ? Or those both app request some "central
>> authority" ?
>>
>> Thank you,
>>
>> --
>> 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-j...@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.
>>
>>
>
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> Blog: http://googleappengine.blogspot.com
> Twitter: http://twitter.com/app_engine
> Reddit: http://www.reddit.com/r/appengine
>
>  --
> 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-j...@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-j...@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.



Re: [appengine-java] Get objects back in the order they were inserted into the data store?

2010-07-21 Thread Mark Wyszomierski
Hi Ikai,

Sorry to bug you, I didn't quite follow - reworded here:

I *do* need an index on the timestamp field because I want a desc filter.
This ordering may not exactly be the insertion order, but pretty close. If I
wanted to present the objects by real insertion order, I'd need an
additional index.

Did I follow right? Yeah I don't care about insertion order really, just
about the timestamp desc ordering - I figured timestamp desc and insertion
order (in my case) would produce nearly identical results, so was just going
to try springing on the timestamp index. Seems that I should definitely
index on it though,

Thanks,
Mark


On Wed, Jul 21, 2010 at 7:37 PM, Ikai L (Google)  wrote:

> You'll need an index no matter what, as if you did this, you'd need Key
> descending. Note that this may not be exact insert order but it'll be pretty
> close. This seems to save an index, though, as doing it another way requires
> both ascending and descending indexes.
>
> On Wed, Jul 21, 2010 at 5:52 AM, Mark  wrote:
>
>> Hi,
>>
>> I'm creating records of a user's actions. When I fetch these records,
>> I only ever want them sorted in reverse chronological ordering (the
>> order they were inserted into the datastore). Does app engine by
>> default return records in this order? I'm trying to avoid having to
>> keep an extra index on timestamp to reduce the number of indexes I
>> use. Example (in java):
>>
>>class Action {
>>@PrimaryKey
>>@Extension(vendorName="datanucleus", key="gae.encoded-pk",
>> value="true")
>>private String usernameOwner;
>>
>>@Persistent
>>long timestamp;
>>}
>>
>>public void userActionPerformed(PersistenceManager pm) {
>>pm.makePersistent(new Foo("myusername",
>> System.currentTimeMillis());
>>}
>>
>>public void getRecords(String username) {
>>String stmt = "SELECT FROM " + Action.class.getName() + "
>> WHERE usernameOwner = '" + username + "'";
>>Query q = pm.newQuery(stmt);
>>q.setOrdering("timestamp desc"); // want to avoid this.
>>
>>return (List)q.execute();
>>}
>>
>>// desired html: //
>>You performed a foo action on July 21 at 4:22pm!
>>You performed a boo action on July 21 at 3:21pm!
>>You performed a goo action on July 19 at 9:42pm!
>>...
>>
>> so, it would be great if I don't have to index on the timestamp - just
>> get the records back in the order I inserted them - possible?
>>
>> Thanks
>>
>> --
>> 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-j...@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.
>>
>>
>
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> Blog: http://googleappengine.blogspot.com
> Twitter: http://twitter.com/app_engine
> Reddit: http://www.reddit.com/r/appengine
>
>  --
> 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-j...@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-j...@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.



Re: [appengine-java] Get objects back in the order they were inserted into the data store?

2010-07-21 Thread Ikai L (Google)
You'll need an index no matter what, as if you did this, you'd need Key
descending. Note that this may not be exact insert order but it'll be pretty
close. This seems to save an index, though, as doing it another way requires
both ascending and descending indexes.

On Wed, Jul 21, 2010 at 5:52 AM, Mark  wrote:

> Hi,
>
> I'm creating records of a user's actions. When I fetch these records,
> I only ever want them sorted in reverse chronological ordering (the
> order they were inserted into the datastore). Does app engine by
> default return records in this order? I'm trying to avoid having to
> keep an extra index on timestamp to reduce the number of indexes I
> use. Example (in java):
>
>class Action {
>@PrimaryKey
>@Extension(vendorName="datanucleus", key="gae.encoded-pk",
> value="true")
>private String usernameOwner;
>
>@Persistent
>long timestamp;
>}
>
>public void userActionPerformed(PersistenceManager pm) {
>pm.makePersistent(new Foo("myusername",
> System.currentTimeMillis());
>}
>
>public void getRecords(String username) {
>String stmt = "SELECT FROM " + Action.class.getName() + "
> WHERE usernameOwner = '" + username + "'";
>Query q = pm.newQuery(stmt);
>q.setOrdering("timestamp desc"); // want to avoid this.
>
>return (List)q.execute();
>}
>
>// desired html: //
>You performed a foo action on July 21 at 4:22pm!
>You performed a boo action on July 21 at 3:21pm!
>You performed a goo action on July 19 at 9:42pm!
>...
>
> so, it would be great if I don't have to index on the timestamp - just
> get the records back in the order I inserted them - possible?
>
> Thanks
>
> --
> 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-j...@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.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine

-- 
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-j...@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.



Re: [appengine-java] Re: Tag clouds on GAE for Java - how to store and how to aggregate

2010-07-21 Thread Mark Wyszomierski
Cool, if you structure your entity class like this though:

class Entity {
 List tags;
 String foo;
 }

how are you going to query which Entity instances match a given tag? I think
that all the tags need to be indexed so your query statement can find them -
I'm not 100% sure on this, if you can somehow match on that List,
that would be new to me! I was thinking you might have to decide how many
tags an Entity can have, and explicitly declare each like:

class Entity {
 String tag1, tag2, tag3;
 String foo;
 }

only the first tag is required, the other two can be null. Then your query
statement would have to be something like:

select from Entity where tag1 == 'cow' || tag2 == 'cow' || tag3 ==
'cow';

not sure if there's a better way to do it, let us know what you try because
this is probably a pattern that can be reused for others wanting to do the
same thing,

Thanks,
Mark


On Wed, Jul 21, 2010 at 3:15 PM, planetjones  wrote:

> Mark,
>
> Thanks very much for this - it's useful.  I'm slowly getting used to
> this non-relational way of thinking.
>
> The count of the tags doesn't need to be 100% accurate, as it will
> only be used to approximate how many entries exist for a given tag -
> the tag cloud aim is to show tags associated with many entities in a
> larger font and tags associated with fewer entities in a smaller
> font.  If the insert, update or delete of Entity succeeds and gets
> committed, but the persistence action against the TagCounter fails in
> a few instances that would not be a big deal.
>
> I'll probably allow three tags per Entity, so was planning on:
>
>  class Entity {
>  List tags;
>  String foo;
>  }
>
> for flexibility in of the number of tags.
>
> So when inserting a new entity I would need to:
>
> Create Entity
> For each tag in Entity select TagCounter
> If tag counter exists for tag increment count by 1
> If tag counter does not exist for tag create TagCounter with count of
> 1
>
> When deleting an entity I would need to:
>
> For each tag in Entity select TagCounter
> Decrease count by 1 of TagCounter
> Delete Entity
>
> This sounds ok to me.  When a user clicks a tag the query is simple
> too.
>
> I'll give this a try and see how it looks.
>
> Thanks again.
>
> On Jul 21, 12:46 pm, Mark  wrote:
> > I probably have a naive understanding of what you're doing, maybe
> > explain a little more, but to me it looks like this:
> >
> > class TagCounter {
> > int count;
> > String label; // primary key, unique tag name.
> > }
> >
> > class Entity {
> > String tag;
> > String foo;
> > }
> >
> > whenever the user creates a new entity, record its tag(s), then
> > increment the appropriate TagCounter instance. Keeping counters like
> > this introduces a bottleneck and goes against what you want to be
> > doing for a highly scalable web service, so you may want to shard them
> > (imagine you have thousands of users all trying to increment a single
> > tag counter at once).   Since the above two classes won't be in the
> > same entity group, you wouldn't be able to perform both operations in
> > a single transaction. You can either accept the fact that your tag
> > count may be out of sync with the actual number of entities with that
> > tag, or you can have a multistep process and clean up dangling tag
> > counts with a task (eventual consistency might be the term here). I'm
> > referring to Nick Johnson's article on distributed transactions which
> > I think you can modify to do what you're looking for:
> >
> >http://blog.notdot.net/2009/9/Distributed-Transactions-on-App-Engine
> >
> > I'm still learning app engine so take the above with a big grain of
> > salt. To me, it seems that if you want to write a highly scalable web
> > service, you need to accept that you may lose some data precision, or
> > you have to put in additional work to get what you want (compared to
> > assuming a single mysql instance etc).
> >
> > Anyway, after you implement something like the above, your original
> > two queries should be easy to do. You probably want to define how many
> > tags an Entity can have. If an Entity can have more than one tag, I'd
> > explicitly state what that max is. Write out everything you need when
> > the user submits an entity, so that your reads will be fast as other
> > users browse the site.
> >
> > Mark
> >
> > On Jul 19, 9:16 am, planetjones  wrote:
> >
> >
> >
> > > Hi,
> > > I'm looking to store entities using GAE Java which have 1-many tags.
> > > I
> > > would like to display a tag cloud, so will need to know how many
> > > times
> > > each tag occurs (can't use aggregate functions and group by on GAE to
> > > do this like I would in SQL). And when I click a tag I would like to
> > > retrieve all entities with the selected tag.
> > > Does anyone have any examples of what my Classes should look like to
> > > do this optimally and efficiently? Sample JP

Re: [appengine-java] next gen queries

2010-07-21 Thread Ikai L (Google)
We don't have an ETA yet. We'll announce it when it's ready.

On Mon, Jul 19, 2010 at 11:08 AM, pac  wrote:

> In Alfred Fuller's presentation (http://www.youtube.com/watch?
> v=ofhEyDBpngM&feature=channel), he mentioned that limit of 5000 list
> items and need for number of composite indexes for list (i.e. 2 value
> search from list, 3 value search from list etc) will be removed. As
> per video, I think he mentioned that functionality is nearly in place.
>
> At this stage, is it possible to give an approx idea when can we
> expect this one out?
>
> --
> 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-j...@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.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine

-- 
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-j...@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.



Re: [appengine-java] How to "close" an object before second transaction?

2010-07-21 Thread Ikai L (Google)
Can you start the transaction before you do the fetch? The way you're
writing it won't result in what you want to do.

If that still doesn't work, just retrieve a new instance of the
PersistenceManager. This is cheap so it won't cost you significant
additional CPU.

On Mon, Jul 19, 2010 at 5:59 AM, coltsith  wrote:

> Here's the psudo-code for one of my methods:
>
>
> 1. Get PersistenceManager (pm)
>
> 2. pm.fetchObject1
>
> 3. pm.beginTransaction
>
> 4. pm.modifyObject1
>
> 5. pm.commit
>
> 6. pm.fetchObject2
>
> 7. pm.beginTransaction
>
> 8. pm.modifyObject2
>
> 9. pm.commit
>
> however I get this error "can't operate on multiple entity groups in a
> single transaction..."
>
> Do I have to put another line in between step 5 and 7 saying that I'm
> 'done' with object1, like to close it?
>
> Thanks
>
> --
> 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-j...@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.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine

-- 
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-j...@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.



Re: [appengine-java] Share session between 3rd party domain (google apps) and appspot.com?

2010-07-21 Thread Ikai L (Google)
There's no single sign on capability yet, but if you use OpenID, the use
experience can come pretty close.

On Mon, Jul 19, 2010 at 3:27 AM, Just  wrote:

> Hi,
>
> is it possible to share the session between a google apps domain and
> appspot.com?
> I wanted to use the ssl of appspot.com for secure login and the
> redirect back to regular domain.
>
> Regards
>
> --
> 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-j...@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.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine

-- 
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-j...@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.



Re: [appengine-java] Date, Calendar question (multiple instances of web application behaviour) clarification

2010-07-21 Thread Ikai L (Google)
It should just be whatever the date is on the current instance. In general,
do not ever rely on dates to be synchronized. Clock skew is a reality of
distributed computing, and you'll have to work around it. What exactly is
the problem you're trying to solve?

On Sun, Jul 18, 2010 at 11:23 PM, Marcus Brody  wrote:

> Good day,
>
> I would like to ask about following.
>
> How is java.util.Date synchronized in case there is more than 1
> instance of my web application.
> Example:
>
> WebAppInstance01 : I create somewhere new Date()
>
> at the same time
> WebAppInstance02: I create somewhere  new Date()
>
> Is there some time shift ? Or those both app request some "central
> authority" ?
>
> Thank you,
>
> --
> 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-j...@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.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine

-- 
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-j...@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.



Re: [appengine-java] app works in IE but not in Firefox and safari!

2010-07-21 Thread Ikai L (Google)
Looks okay to me. You might want to post better reproduction steps:

http://www.softwaretestinghelp.com/how-to-write-good-bug-report/

On Fri, Jul 16, 2010 at 3:45 PM, karasu kuro  wrote:

> app:
> http://easyalarm97531.appspot.com
> works fine in IE but not in Firefox and Safari.
>
> IE version:6.0.28
> Firefox version:3.6.6
> Safari(Mac) version:5.0
> Eclipse version:Helios
> java version:1.6.0_21
>
> --
> 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-j...@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.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine

-- 
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-j...@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.



[appengine-java] Re: Tag clouds on GAE for Java - how to store and how to aggregate

2010-07-21 Thread planetjones
Mark,

Thanks very much for this - it's useful.  I'm slowly getting used to
this non-relational way of thinking.

The count of the tags doesn't need to be 100% accurate, as it will
only be used to approximate how many entries exist for a given tag -
the tag cloud aim is to show tags associated with many entities in a
larger font and tags associated with fewer entities in a smaller
font.  If the insert, update or delete of Entity succeeds and gets
committed, but the persistence action against the TagCounter fails in
a few instances that would not be a big deal.

I'll probably allow three tags per Entity, so was planning on:

 class Entity {
         List tags;
         String foo;
     }

for flexibility in of the number of tags.

So when inserting a new entity I would need to:

Create Entity
For each tag in Entity select TagCounter
If tag counter exists for tag increment count by 1
If tag counter does not exist for tag create TagCounter with count of
1

When deleting an entity I would need to:

For each tag in Entity select TagCounter
Decrease count by 1 of TagCounter
Delete Entity

This sounds ok to me.  When a user clicks a tag the query is simple
too.

I'll give this a try and see how it looks.

Thanks again.

On Jul 21, 12:46 pm, Mark  wrote:
> I probably have a naive understanding of what you're doing, maybe
> explain a little more, but to me it looks like this:
>
>     class TagCounter {
>         int count;
>         String label; // primary key, unique tag name.
>     }
>
>     class Entity {
>         String tag;
>         String foo;
>     }
>
> whenever the user creates a new entity, record its tag(s), then
> increment the appropriate TagCounter instance. Keeping counters like
> this introduces a bottleneck and goes against what you want to be
> doing for a highly scalable web service, so you may want to shard them
> (imagine you have thousands of users all trying to increment a single
> tag counter at once).   Since the above two classes won't be in the
> same entity group, you wouldn't be able to perform both operations in
> a single transaction. You can either accept the fact that your tag
> count may be out of sync with the actual number of entities with that
> tag, or you can have a multistep process and clean up dangling tag
> counts with a task (eventual consistency might be the term here). I'm
> referring to Nick Johnson's article on distributed transactions which
> I think you can modify to do what you're looking for:
>
>    http://blog.notdot.net/2009/9/Distributed-Transactions-on-App-Engine
>
> I'm still learning app engine so take the above with a big grain of
> salt. To me, it seems that if you want to write a highly scalable web
> service, you need to accept that you may lose some data precision, or
> you have to put in additional work to get what you want (compared to
> assuming a single mysql instance etc).
>
> Anyway, after you implement something like the above, your original
> two queries should be easy to do. You probably want to define how many
> tags an Entity can have. If an Entity can have more than one tag, I'd
> explicitly state what that max is. Write out everything you need when
> the user submits an entity, so that your reads will be fast as other
> users browse the site.
>
> Mark
>
> On Jul 19, 9:16 am, planetjones  wrote:
>
>
>
> > Hi,
> > I'm looking to store entities using GAE Java which have 1-many tags.
> > I
> > would like to display a tag cloud, so will need to know how many
> > times
> > each tag occurs (can't use aggregate functions and group by on GAE to
> > do this like I would in SQL). And when I click a tag I would like to
> > retrieve all entities with the selected tag.
> > Does anyone have any examples of what my Classes should look like to
> > do this optimally and efficiently? Sample JPA code would be great
> > too.
> > Cheers - Jonathan

-- 
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-j...@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.



[appengine-java] Re: Active transactions

2010-07-21 Thread Marcus Brody
Hello again,

I cannot give you straightforward answer,
try to do as little as possible. Create simple entity,
try to create new, delete some by key, createIfNotExists and similar
DAO methods. Do not put any nontrivial logic to this DAO.

Also make sure you entities have "right" key type and such,
your crearPartido method has somehow too many arguments try to make it
more simple.

step by step.




On Jul 22, 12:37 am, lisandrodc  wrote:
> Hi!Marcus, now I use your pattern for transactions:
> The code of the method:
> public void crearPartido(Long idEqLocal, Long idEqVisitante, Date
> fecha,
>                         Fecha fechaAgreg, String resultado, String hora,Long 
> idTorneo){
>
>                 PersistenceManager pm = 
> JDOHelper.getPersistenceManager(fechaAgreg);
>
>                 Transaction tx = pm.currentTransaction();
>
>                 try {
>                         tx.begin();
>                         Partido par1 = null;
>                         ControladorTorneo cT= new ControladorTorneo();
>                         par1 = new Partido(null, new Resultado(),
> cT.devolverEquipo( idTorneo,idEqLocal),
> cT.devolverEquipo(idTorneo,idEqVisitante), fecha, hora);
>              /*In mode debug, is here below where accedes for the
> block finally(with error)       */
>                  fechaAgreg.agregarPartido(par1);
>
>                         pm.makePersistent(fechaAgreg);
>                         tx.commit();
>
>                 } finally {
>                          if (tx != null && tx.isActive())
>                                  tx.rollback();
>                   pm.close();
>                 }
>
>         }
>
> But now, the error is:
>
>  "Object with id "com.google.appengine.api.datastore.Key:Torneo(1)/
> Equipo(3)" is managed by a different Object Manager".
>
> I try also changed in the code:
>  "PersistenceManager pm = getPersistenceManager();
> For:
> "PersistenceManager pm =
> JDOHelper.getPersistenceManager(fechaAgreg);"(But mistake is the one
> that already I enunciated).
> The 
> link:http://stackoverflow.com/questions/1403515/appengine-datastore-object...
> Regards
> Lisandro
>
> On 19 jul, 05:15, Marcus Brody  wrote:
>
> > try follow this pattern for transactions
>
> > public void doSomthingWithEntity(T entity) {
>
> >                 PersistenceManager pm = getPersistenceManager();
> >                 Transaction transaction = pm.currentTransaction();
>
> >                 try {
> >                         transaction.begin();
> > //                      do something with entity, get, persist, delete
> > //                      pm.makePersistent(entity);
>
> >                         transaction.commit();
> >                 }
> >                 finally {
> >                         if (transaction != null && transaction.isActive())
> > transaction.rollback();
> >                         pm.close();
> >                 }
> >         }
>
> > On Jul 18, 11:01 pm, lisandrodc  wrote:
>
> > > Hi! I have a problem with active transaction.When I try to guard in
> > > the datastore, says:
>
> > >  "La transaccion esta activo todavia. Debe cerrar las transacciones
> > > usando los metodos commit() o rollback()."
>
> > > As closure all the transactions?
> > > The method is:
>
> > > PersistenceManager pm2 = JDOHelper.getPersistenceManager(fechaAgreg);
>
> > >                 Transaction tx = pm2.currentTransaction();
>
> > >                 try {
> > >                         tx.begin();
> > >                         Partido par1 = null;
> > >                         ControladorTorneo cT= new ControladorTorneo();
> > >                         par1 = new Partido(null, new Resultado(),
> > > cT.devolverEquipo( idTorneo,idEqLocal),
> > > cT.devolverEquipo(idTorneo,idEqVisitante), fecha, hora);
>
> > >                         fechaAgreg.agregarPartido(par1);
> > >                         pm2.makePersistent(fechaAgreg);
> > >                         tx.commit();
>
> > >                 } finally {
> > >                         pm2.close();
>
> > >                         if (tx.isActive()) {
> > >                                 tx.rollback();
> > >                         }
> > >                 }
>
> > >         }
>
> > > Regards
>
>

-- 
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-j...@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.



[appengine-java] Re: Active transactions

2010-07-21 Thread lisandrodc
Hi!Marcus, now I use your pattern for transactions:
The code of the method:
public void crearPartido(Long idEqLocal, Long idEqVisitante, Date
fecha,
Fecha fechaAgreg, String resultado, String hora,Long 
idTorneo){


PersistenceManager pm = 
JDOHelper.getPersistenceManager(fechaAgreg);

Transaction tx = pm.currentTransaction();

try {
tx.begin();
Partido par1 = null;
ControladorTorneo cT= new ControladorTorneo();
par1 = new Partido(null, new Resultado(),
cT.devolverEquipo( idTorneo,idEqLocal),
cT.devolverEquipo(idTorneo,idEqVisitante), fecha, hora);
 /*In mode debug, is here below where accedes for the
block finally(with error)   */
 fechaAgreg.agregarPartido(par1);


pm.makePersistent(fechaAgreg);
tx.commit();

} finally {
 if (tx != null && tx.isActive())
 tx.rollback();
  pm.close();
}

}

But now, the error is:

 "Object with id "com.google.appengine.api.datastore.Key:Torneo(1)/
Equipo(3)" is managed by a different Object Manager".

I try also changed in the code:
 "PersistenceManager pm = getPersistenceManager();
For:
"PersistenceManager pm =
JDOHelper.getPersistenceManager(fechaAgreg);"(But mistake is the one
that already I enunciated).
The link:
http://stackoverflow.com/questions/1403515/appengine-datastore-object-with-id-is-managed-by-a-different-object-manager
Regards
Lisandro

On 19 jul, 05:15, Marcus Brody  wrote:
> try follow this pattern for transactions
>
> public void doSomthingWithEntity(T entity) {
>
>                 PersistenceManager pm = getPersistenceManager();
>                 Transaction transaction = pm.currentTransaction();
>
>                 try {
>                         transaction.begin();
> //                      do something with entity, get, persist, delete
> //                      pm.makePersistent(entity);
>
>                         transaction.commit();
>                 }
>                 finally {
>                         if (transaction != null && transaction.isActive())
> transaction.rollback();
>                         pm.close();
>                 }
>         }
>
> On Jul 18, 11:01 pm, lisandrodc  wrote:
>
> > Hi! I have a problem with active transaction.When I try to guard in
> > the datastore, says:
>
> >  "La transaccion esta activo todavia. Debe cerrar las transacciones
> > usando los metodos commit() o rollback()."
>
> > As closure all the transactions?
> > The method is:
>
> > PersistenceManager pm2 = JDOHelper.getPersistenceManager(fechaAgreg);
>
> >                 Transaction tx = pm2.currentTransaction();
>
> >                 try {
> >                         tx.begin();
> >                         Partido par1 = null;
> >                         ControladorTorneo cT= new ControladorTorneo();
> >                         par1 = new Partido(null, new Resultado(),
> > cT.devolverEquipo( idTorneo,idEqLocal),
> > cT.devolverEquipo(idTorneo,idEqVisitante), fecha, hora);
>
> >                         fechaAgreg.agregarPartido(par1);
> >                         pm2.makePersistent(fechaAgreg);
> >                         tx.commit();
>
> >                 } finally {
> >                         pm2.close();
>
> >                         if (tx.isActive()) {
> >                                 tx.rollback();
> >                         }
> >                 }
>
> >         }
>
> > Regards
>
>

-- 
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-j...@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.



[appengine-java] Re: Are the 2 indexes same?

2010-07-21 Thread Tapir
Seems for conditions, they are same, for orderings, they are not same.

On Jul 21, 8:45 am, Robert Lancer  wrote:
> No they are not, that would actually create two indexes even though
> your queries against these indexes might be fairly interchangeable.
>
> On Jul 20, 6:57 pm, Tapir  wrote:
>
>
>
> >     
> >         
> >         
> >     
>
> >     
> >         
> >         
> >     - Hide quoted text -
>
> - Show quoted text -

-- 
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-j...@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.



[appengine-java] Re: when vacuum_indexes will be implemented?

2010-07-21 Thread Tapir
so vacuum_indexes is really needed, right?

On Jul 21, 11:44 am, Didier Durand  wrote:
> Yes, it will need more processing: each new / updated / deleted entity
> will be reflected in each of those indexes.
>
> Lots of details 
> athttp://code.google.com/appengine/articles/index_building.html
>
> didier
>
> On Jul 21, 12:54 am, Tapir  wrote:
>
>
>
> > Now my app has many unused indexes.
> > Will them affect the entity creating and updating efficiency?- Hide quoted 
> > text -
>
> - Show quoted text -

-- 
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-j...@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.



[appengine-java] Re: Entity relationship table

2010-07-21 Thread dmetri333
Hey John, thanks for the reply
twig looks interesting but im not using JDO, like i mentioned in my
post.

Also, im not trying to get this specific code to work, im trying to
get help on finding the best way to build entity's that would work
with my intended behavior (mentioned in my first post).
If i was using a rational DB, i would have structured my tables the
following:

User
---
id
etc...

Person
--
id
user_id
name
etc...

PersonRelationship
--
person_id
friend_id<---   this is an id from the Persons table


Im trying to found out how i would do this using GAE/JAVA/JPA

On Jul 21, 4:01 pm, John Patterson  wrote:
> On 22 Jul 2010, at 02:53, dmetri333 wrote:
>
>
>
> >    private List friends = new ArrayList();
>
> You cannot have direct references for unowned relationships in JDO-GAE.
>
> Twig is the only datastore interface I know of that does allow this
>
> http://code.google.com/p/twig-persist/

-- 
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-j...@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.



[appengine-java] Re: Can I query keys only instead of full entities?

2010-07-21 Thread TL
Thanks everyone for all your answers, case closed :)

-- 
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-j...@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.



[appengine-java] Blobstore and 206 (Partial Content) responses

2010-07-21 Thread keyurva
The BlobstoreService recently added support for serving partial byte
ranges from a blob. When this method is invoked the response is
generated with a HTTP 206 (Partial Content) status code. So it looks
like app engine assumes that it is always serving a Range request in
this case.

However, in my case I have bundled many files into one blob entry and
I know the byte range of each. From the client's perspective they only
access a URL representing an individual file. Behind the scenes, I
invoke the ByteRange based serve method on the blob store to serve the
file. HTTP 200 is the more appropriate response in my case however the
app engine always returns 206.

Is there a way to override this behavior? (i.e. return 200 instead of
206?)

Thanks,
Keyur

-- 
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-j...@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.



Re: [appengine-java] Re: Entity relationship table

2010-07-21 Thread John Patterson


On 22 Jul 2010, at 02:53, dmetri333 wrote:



private List friends = new ArrayList();


You cannot have direct references for unowned relationships in JDO-GAE.

Twig is the only datastore interface I know of that does allow this

http://code.google.com/p/twig-persist/

--
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-j...@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.



[appengine-java] Re: Entity relationship table

2010-07-21 Thread dmetri333
I watched the video and im still having some trouble,  A lot of his
examples where in python while im using JAVA/JPA, also i may be having
trouble pulling myself away from the idea of rational dbs

It may be the way im structuring my Entities.
my classes are below, It currently doesn't work in app engine but its
generally what im going for, how should i be setting it up.  I want to
be able to perform queries on friends list as well, like sorting,
etc...

@Entity
public class User {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
...Other Properties...

@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private Person person = new Person();

...getters and setters...
}

@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key key;
private String name;

@OneToMany(cascade = CascadeType.ALL)
private List friends = new ArrayList();

...getters and setters...
}

On Jul 19, 11:38 am, Nacho Coloma  wrote:
> My 2 cents: if all your users are of type Person and it's a root
> entity, you can also save some space by storing Key ids instead of Key
> instances (you save the redundant type name etc).
>
> On Jul 19, 5:53 am, "Ikai L (Google)"  wrote:
>
> > The best practice is probably to create list properties with Keys
> > representing friend IDs. This is a good video to watch:
>
> >http://www.youtube.com/watch?v=AgaL6NGpkB8
>
> > On Fri, Jul 16, 2010 at 8:03 AM, dmetri333  wrote:
> > > Imrelativelynew too GAE and the Datastore, and i had a question on
> > > the best way to setup some entities.
>
> > > I have created a entity called 'Person' and this person has a list of
> > > friends in the system that are also of type 'Person'.  In SQL i would
> > > have created a simple linker/relationship table with 2 fields
> > > (person_id, friend_id), both referring to the same id from the
> > > 'Person' table.
>
> > > I was wondering what the best practice for doing this with GAE and
> > > bigtable.
>
> > > demetri
>
> > > --
> > > 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-j...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-appengine-java+unsubscr...@googlegroups.com > >  unsubscr...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine-java?hl=en.
>
> > --
> > Ikai Lan
> > Developer Programs Engineer, Google App Engine
> > Blog:http://googleappengine.blogspot.com
> > Twitter:http://twitter.com/app_engine
> > Reddit:http://www.reddit.com/r/appengine

-- 
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-j...@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.



[appengine-java] Re: Can I query keys only instead of full entities?

2010-07-21 Thread Florian
Using the native API the is Query.setKeysOnly() that "Makes this query
fetch and return only keys, not full entities."

http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Query.html#setKeysOnly()


Is this what you are looking for?


On Jul 21, 5:21 am, TL  wrote:
> I want to run a query and receive a few keys, which I will delete
> afterwards. The problem is that queries return the entire entity,
> unnecessary work for the data store and the client (which is also
> reflected as slower page performance and higher bills).
> All I want from the query is the keys.
>
> In SQL it would be something like
> select t.id from table t where t.column > someValue
>
> Is there a way to get it using the native API or in another way? I
> imagine that JPA will do the same if the underlying libraries can only
> return full records.

-- 
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-j...@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.



[appengine-java] appcfg bulkuploading null key values from csv

2010-07-21 Thread Dani
Hi, I created a new app and I want to fill it with data from an old
django app using csv files.


The Java app is like:

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Callerid {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;

@Persistent
private String num;

@Persistent
private Key queue;


The config.yml is like:

- kind: Callerid
  connector: csv
  connector_options:
  property_map:
- property: __key__
  external_name: key
  export_transform: transform.key_id_or_name_as_string

- property: queue
  external_name: queue
  import_transform: transform.create_foreign_key('Queue')
  export_transform: transform.key_id_or_name_as_string

- property: num
  external_name: num


And finally a csv example:

key,queue,num
111,,9

When i run: appcfg.py upload_data --config_file=config.yml --
filename=Callerid.csv --url=http://APPID.appspot.com/remote_api --
application=APPID --kind=Callerid

Returns this error: BadValueError: name must not be empty.

By the way, i can entry a new entity via the admin site, with null
values in the queue field.

What is wrong? how can i upload null values?

Thanks!

-- 
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-j...@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.



[appengine-java] Re: Can I query keys only instead of full entities?

2010-07-21 Thread Florian
Using the native API the is Query.setKeysOnly() that "Makes this query
fetch and return only keys, not full entities."

http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Query.html#setKeysOnly()


Is this what you are looking for?

On Jul 21, 5:21 am, TL  wrote:
> I want to run a query and receive a few keys, which I will delete
> afterwards. The problem is that queries return the entire entity,
> unnecessary work for the data store and the client (which is also
> reflected as slower page performance and higher bills).
> All I want from the query is the keys.
>
> In SQL it would be something like
> select t.id from table t where t.column > someValue
>
> Is there a way to get it using the native API or in another way? I
> imagine that JPA will do the same if the underlying libraries can only
> return full records.

-- 
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-j...@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.



Re: [appengine-java] Re: Error using JPA

2010-07-21 Thread Ronmell Fuentes
It seems that when deploying the .jar file used by your application are not
being uploaded to the server in GAE.
so, as I alredy told you the only thing that could be causing this error (at
least the one I know) is the lack of the .jar files (libraries) in the right
Directory I mean, war/WEB-INF/lib/


Ronmell.

2010/7/20 Sajid 

> Hi Ronmell,
>
> I haven't run the examples. My application runs perfectly on local
> server. but after deployment, it gives the error.
>
> On Jul 21, 12:21 am, Ronmell Fuentes  wrote:
> > when running the examples you've got the same error?
> >
> > 2010/7/20 Sajid 
> >
> > > I have already checked that. All jars are in WEB-INF lib folder.
> >
> > > On Jul 20, 11:58 pm, Ronmell Fuentes  wrote:
> > > > Hi Sajid.
> >
> > > > Try to copy all the .jar files used by your app to the /WAR/lib
> directory
> > > of
> > > > your app.
> >
> > > > Ronmell
> >
> > > > 2010/7/20 Sajid 
> >
> > > > > Hi
> >
> > > > > I am using spring 3, jsf2 and jpa. I load entity manager factory
> sing
> > > > > spring context xml. However, I am getting class not found error for
> > > > > javax.persistence.EntityManagerFactory
> >
> > > > > StackTrace:
> > > > > #
> >
> > > > > javax.servlet.ServletException: java.lang.RuntimeException:
> > > > > java.lang.ClassNotFoundException:
> > > > > javax.persistence.EntityManagerFactory
> > > > >at
> >
> > >
> com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:
> > > > > 240)
> > > > >at
> > > > >
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> > > > > 152)
> > > > >at org.mortbay.jetty.Server.handle(Server.java:326)
> > > > >at
> > > > > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> > > > > 542)
> > > > >at org.mortbay.jetty.HttpConnection
> > > > > $RequestHandler.headerComplete(HttpConnection.java:923)
> > > > >at
> >
> > >
> com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:
> > > > > 76)
> > > > >at
> > > org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> > > > >at
> >
> > >
> com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:
> > > > > 135)
> > > > >at
> >
> > >
> com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
> > > > > 250)
> > > > >at com.google.apphosting.base.RuntimePb$EvaluationRuntime
> > > > > $6.handleBlockingRequest(RuntimePb.java:7115)
> > > > >at com.google.apphosting.base.RuntimePb$EvaluationRuntime
> > > > > $6.handleBlockingRequest(RuntimePb.java:7113)
> > > > >at
> >
> > >
> com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:
> > > > > 24)
> > > > >at
> > > com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
> > > > > 398)
> > > > >at com.google.net.rpc.impl.Server$2.run(Server.java:852)
> > > > >at
> >
> > >
> com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:
> > > > > 56)
> > > > >at
> >
> > >
> com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:
> > > > > 576)
> > > > >at com.google.net.rpc.impl.Server.startRpc(Server.java:807)
> > > > >at
> > > com.google.net.rpc.impl.Server.processRequest(Server.java:369)
> > > > >at
> >
> > >
> com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:
> > > > > 442)
> > > > >at
> > > > >
> com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:
> > > > > 319)
> > > > >at
> > > > >
> com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:
> > > > > 290)
> > > > >at
> > > com.google.net.async.Connection.handleReadEvent(Connection.java:
> > > > > 474)
> > > > >at
> >
> > >
> com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:
> > > > > 831)
> > > > >at
> > > > >
> com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:
> > > > > 207)
> > > > >at
> > > com.google.net.async.EventDispatcher.loop(EventDispatcher.java:
> > > > > 103)
> > > > >at
> > > > >
> com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:
> > > > > 251)
> > > > >at com.google.apphosting.runtime.JavaRuntime
> > > > > $RpcRunnable.run(JavaRuntime.java:417)
> > > > >at java.lang.Thread.run(Unknown Source)
> > > > > Caused by: java.lang.RuntimeException:
> > > > > java.lang.ClassNotFoundException:
> > > > > javax.persistence.EntityManagerFactory
> > > > >at
> >
> > >
> com.google.apphosting.runtime.jetty.SessionManager.deserialize(SessionManager.java:
> > > > > 389)
> > > > >at
> >
> > >
> com.google.apphosting.runtime.jetty.SessionManager.loadSession(SessionManager.java:
> > > > > 307)
> > > > >at
> >
> > >
> com.google.apphosting.runtime.jetty.Ses

Re: [appengine-java] Re: Updated Eclipse Plugin ?

2010-07-21 Thread Rajeev Dayal
Actually, the App Engine 1.3.5 SDK has been packaged with the Google Plugin
for Eclipse. The reason that it does not come up when you use "Check for
Updates" is because we change the feature id of the SDK bundle for each
release (to prevent Eclipse from removing "features" that it thinks are
unused).

Instead of using the "Check for Updates" functionality in Eclipse, go to
"Install New Software", and select the Google Plugin for Eclipse's update
site. You should see the App Engine 1.3.5 SDK Bundle listed there.

See the following instructions for more information:

http://code.google.com/eclipse/docs/updating_the_plugin.html
 

On Wed, Jul 21, 2010 at 9:59 AM, Navaneeth Krishnan <
navaneeth.cont...@gmail.com> wrote:

>
> Turns out that one needs to download the latest version of the sdk and
> configure eclipse it:
> http://code.google.com/eclipse/docs/using_sdks.html
>
> @Hari,
> The update will not get you the latest version of GAE because the
> latest version of the plugin uses an older version of GAE.
>
> Regards,
> Navaneeth
>
>
> On Jul 20, 7:14 am, Hariharan Anantharaman
>  wrote:
> > From your eclipse itself(having an older version of gae), you can update
> to
> > latest version by using software updates option in elclipse.
> >
> > Thanks
> > Hari
> >
> > On Jul 19, 2010 9:39 PM, "Navaneeth Krishnan" <
> navaneeth.cont...@gmail.com>
> > wrote:
> >
> > I tried out the latest version of the eclipse plugin for GAE
> >
> > http://code.google.com/appengine/docs/java/gettingstarted/installing
> >
> > to realize that the bundled app engine version is 1.3.3. If there any
> > plan to upgrade it to the latest SDK (1.3.5) ?
> >
> > When can we expect a new release ?
> >
> > Also, is there a way to manually upgrade the eclipse plugin ?
> >
> > --
> > 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-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group athttp://
> 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-j...@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-j...@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.



[appengine-java] Re: Updated Eclipse Plugin ?

2010-07-21 Thread Navaneeth Krishnan

Turns out that one needs to download the latest version of the sdk and
configure eclipse it:
http://code.google.com/eclipse/docs/using_sdks.html

@Hari,
The update will not get you the latest version of GAE because the
latest version of the plugin uses an older version of GAE.

Regards,
Navaneeth


On Jul 20, 7:14 am, Hariharan Anantharaman
 wrote:
> From your eclipse itself(having an older version of gae), you can update to
> latest version by using software updates option in elclipse.
>
> Thanks
> Hari
>
> On Jul 19, 2010 9:39 PM, "Navaneeth Krishnan" 
> wrote:
>
> I tried out the latest version of the eclipse plugin for GAE
>
> http://code.google.com/appengine/docs/java/gettingstarted/installing
>
> to realize that the bundled app engine version is 1.3.3. If there any
> plan to upgrade it to the latest SDK (1.3.5) ?
>
> When can we expect a new release ?
>
> Also, is there a way to manually upgrade the eclipse plugin ?
>
> --
> 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-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com unsubscr...@googlegroups.com>
> .
> For more options, visit this group 
> athttp://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-j...@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.



[appengine-java] Get objects back in the order they were inserted into the data store?

2010-07-21 Thread Mark
Hi,

I'm creating records of a user's actions. When I fetch these records,
I only ever want them sorted in reverse chronological ordering (the
order they were inserted into the datastore). Does app engine by
default return records in this order? I'm trying to avoid having to
keep an extra index on timestamp to reduce the number of indexes I
use. Example (in java):

class Action {
@PrimaryKey
@Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
private String usernameOwner;

@Persistent
long timestamp;
}

public void userActionPerformed(PersistenceManager pm) {
pm.makePersistent(new Foo("myusername",
System.currentTimeMillis());
}

public void getRecords(String username) {
String stmt = "SELECT FROM " + Action.class.getName() + "
WHERE usernameOwner = '" + username + "'";
Query q = pm.newQuery(stmt);
q.setOrdering("timestamp desc"); // want to avoid this.

return (List)q.execute();
}

// desired html: //
You performed a foo action on July 21 at 4:22pm!
You performed a boo action on July 21 at 3:21pm!
You performed a goo action on July 19 at 9:42pm!
...

so, it would be great if I don't have to index on the timestamp - just
get the records back in the order I inserted them - possible?

Thanks

-- 
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-j...@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.



[appengine-java] Re: Tag clouds on GAE for Java - how to store and how to aggregate

2010-07-21 Thread Mark
I probably have a naive understanding of what you're doing, maybe
explain a little more, but to me it looks like this:

class TagCounter {
int count;
String label; // primary key, unique tag name.
}

class Entity {
String tag;
String foo;
}

whenever the user creates a new entity, record its tag(s), then
increment the appropriate TagCounter instance. Keeping counters like
this introduces a bottleneck and goes against what you want to be
doing for a highly scalable web service, so you may want to shard them
(imagine you have thousands of users all trying to increment a single
tag counter at once).   Since the above two classes won't be in the
same entity group, you wouldn't be able to perform both operations in
a single transaction. You can either accept the fact that your tag
count may be out of sync with the actual number of entities with that
tag, or you can have a multistep process and clean up dangling tag
counts with a task (eventual consistency might be the term here). I'm
referring to Nick Johnson's article on distributed transactions which
I think you can modify to do what you're looking for:

http://blog.notdot.net/2009/9/Distributed-Transactions-on-App-Engine

I'm still learning app engine so take the above with a big grain of
salt. To me, it seems that if you want to write a highly scalable web
service, you need to accept that you may lose some data precision, or
you have to put in additional work to get what you want (compared to
assuming a single mysql instance etc).

Anyway, after you implement something like the above, your original
two queries should be easy to do. You probably want to define how many
tags an Entity can have. If an Entity can have more than one tag, I'd
explicitly state what that max is. Write out everything you need when
the user submits an entity, so that your reads will be fast as other
users browse the site.

Mark

On Jul 19, 9:16 am, planetjones  wrote:
> Hi,
> I'm looking to store entities using GAE Java which have 1-many tags.
> I
> would like to display a tag cloud, so will need to know how many
> times
> each tag occurs (can't use aggregate functions and group by on GAE to
> do this like I would in SQL). And when I click a tag I would like to
> retrieve all entities with the selected tag.
> Does anyone have any examples of what my Classes should look like to
> do this optimally and efficiently? Sample JPA code would be great
> too.
> Cheers - Jonathan

-- 
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-j...@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.



[appengine-java] Re: Can I query keys only instead of full entities?

2010-07-21 Thread Didier Durand
Hi,

Here the "official" details on our question:
http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html#Queries_on_Keys

didier

On Jul 21, 5:21 am, TL  wrote:
> I want to run a query and receive a few keys, which I will delete
> afterwards. The problem is that queries return the entire entity,
> unnecessary work for the data store and the client (which is also
> reflected as slower page performance and higher bills).
> All I want from the query is the keys.
>
> In SQL it would be something like
> select t.id from table t where t.column > someValue
>
> Is there a way to get it using the native API or in another way? I
> imagine that JPA will do the same if the underlying libraries can only
> return full records.

-- 
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-j...@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.



[appengine-java] Re: Must only return a redirect from a Blobstore upload callback??? What does it mean?

2010-07-21 Thread ww34ww34
ok, i've read documentation, but my doubt still remain.
My code work...and has the same structure as you show me.
But , I don't understand the meaning of this warning,
I was worried about the warning level GRAVE.

On 20 Lug, 11:05, Thomas  wrote:
> I forgot to metion that If you used jsp as handler, you should call
> the response.sendRedirect(...) in your jsp's scriptlet.

-- 
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-j...@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.



[appengine-java] Re: Can I query keys only instead of full entities?

2010-07-21 Thread l.denardo
Low level API has a method to do this, in JDO/JPA simply select only
key field in your query.

See

http://gae-java-persistence.blogspot.com/2009/10/keys-only-queries.html

(from Max Ross, GAE team) for details.

Regards
Lorenzo

On Jul 21, 5:21 am, TL  wrote:
> I want to run a query and receive a few keys, which I will delete
> afterwards. The problem is that queries return the entire entity,
> unnecessary work for the data store and the client (which is also
> reflected as slower page performance and higher bills).
> All I want from the query is the keys.
>
> In SQL it would be something like
> select t.id from table t where t.column > someValue
>
> Is there a way to get it using the native API or in another way? I
> imagine that JPA will do the same if the underlying libraries can only
> return full records.

-- 
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-j...@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.