[appengine-java] Relationships between entities of of same kind

2011-02-06 Thread Cyrille Vincey
Some time ago, relationships between entities of same kind were not
supported by the datastore.
This was annoying in particular when trying to movel tree structures
(@OneToMany relationship between MyClass and MyClass).
The datastore documentation was pretty clear about this.

I cannot find this limitation in the datastore documentation anymore.
Have I missed a good news about a recent release allowing relationships
inside entities of the same kind ?


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



Re: [appengine-java] Relationships between entities of of same kind

2011-02-06 Thread Jan Willies
2011/2/6 Cyrille Vincey crll...@gmail.com

 Some time ago, relationships between entities of same kind were not
 supported by the datastore.
 This was annoying in particular when trying to movel tree structures
 (@OneToMany relationship between MyClass and MyClass).
 The datastore documentation was pretty clear about this.

 I cannot find this limitation in the datastore documentation anymore.
 Have I missed a good news about a recent release allowing relationships
 inside entities of the same kind ?


I tried it a few days ago (with JDO) and it didn't work.

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



Re: [appengine-java] Re: Problem Authenticating against App Engine

2011-02-06 Thread Fabrizio Accatino
The Nick's way is the good way.

My note was about OAuth. Afaik Android AccountManager class uses
ClientLogin for authentication on App Engine.

Fabrizio


On Sun, Feb 6, 2011 at 5:03 PM, Sky skysoftwaredes...@googlemail.comwrote:

 thanks for the answer. I will try it, as soon as my new mobile sim
 card has been activated ;). In the 2.3 emulator it worked with another
 account...

 ClientLogin: I did not find any sample code. The best documented way I
 found was Nick's blog. Maybe Google should provide some Tutorials/libs
 with sample code, that demonstrates the perfect way to authenticate
 an Android app with app engine using Google accounts...



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



[appengine-java] Re: Relationships between entities of of same kind

2011-02-06 Thread Didier Durand

Hi,

I think that it is still in the doc: see last bullet point of
http://code.google.com/appengine/docs/java/datastore/jdo/overview.html#Unsupported_Features_of_JDO

regards

didier


On Feb 6, 4:48 pm, Jan Willies j...@willies.info wrote:
 2011/2/6 Cyrille Vincey crll...@gmail.com

  Some time ago, relationships between entities of same kind were not
  supported by the datastore.
  This was annoying in particular when trying to movel tree structures
  (@OneToMany relationship between MyClass and MyClass).
  The datastore documentation was pretty clear about this.

  I cannot find this limitation in the datastore documentation anymore.
  Have I missed a good news about a recent release allowing relationships
  inside entities of the same kind ?

 I tried it a few days ago (with JDO) and it didn't work.

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



[appengine-java] Re: Problem Authenticating against App Engine

2011-02-06 Thread Sky
thanks for the clarification!

On 6 Feb., 17:16, Fabrizio Accatino fht...@gmail.com wrote:
 The Nick's way is the good way.

 My note was about OAuth. Afaik Android AccountManager class uses
 ClientLogin for authentication on App Engine.

 Fabrizio

 On Sun, Feb 6, 2011 at 5:03 PM, Sky skysoftwaredes...@googlemail.comwrote:

  thanks for the answer. I will try it, as soon as my new mobile sim
  card has been activated ;). In the 2.3 emulator it worked with another
  account...

  ClientLogin: I did not find any sample code. The best documented way I
  found was Nick's blog. Maybe Google should provide some Tutorials/libs
  with sample code, that demonstrates the perfect way to authenticate
  an Android app with app engine using Google accounts...



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



[appengine-java] Re: Problem Authenticating against App Engine

2011-02-06 Thread Sky
One more question concerning the invalidation of the AuthToken. I read
that it invalidates after 24h. What is when the Activity, holding the
AuthToken (in NicksBlog the AppInfo class), ends (with finish() and
onDestroy) and started again? In my opinion a new valid AuthToken is
fetched every time the Appinfo class gets started.
In this case, why do I have to invalidate the old AuthToken?



On 6 Feb., 19:46, Sky skysoftwaredes...@googlemail.com wrote:
 thanks for the clarification!

 On 6 Feb., 17:16, Fabrizio Accatino fht...@gmail.com wrote:

  The Nick's way is the good way.

  My note was about OAuth. Afaik Android AccountManager class uses
  ClientLogin for authentication on App Engine.

  Fabrizio

  On Sun, Feb 6, 2011 at 5:03 PM, Sky skysoftwaredes...@googlemail.comwrote:

   thanks for the answer. I will try it, as soon as my new mobile sim
   card has been activated ;). In the 2.3 emulator it worked with another
   account...

   ClientLogin: I did not find any sample code. The best documented way I
   found was Nick's blog. Maybe Google should provide some Tutorials/libs
   with sample code, that demonstrates the perfect way to authenticate
   an Android app with app engine using Google accounts...



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



[appengine-java] Re: How to produce a synchronized timestamp?

2011-02-06 Thread timwhunt
I'd love to hear what the official word on the reliability of clock
synchronization is too.  I think the docs say not to rely on it.

One potential solution is to rely on one common time stamp clock
source.  For example a reliable 3rd party API that your code can query
for a time stamp.  You could set up a utility class to get the
timestamp once and statically store the offset from the local JVM
clock, so you only need to query the time stamp from the third part
once per JVM start up.

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



[appengine-java] Re: How to produce a synchronized timestamp?

2011-02-06 Thread Jay Young
Brett Slatkin:

...clocks aren't in sync.  It doesn't work like that.  Even with NTP it 
doesn't work like that.  I saw a server the other day it was 40 minutes 
off.

http://www.google.com/events/io/2010/sessions/high-throughput-data-pipelines-appengine.html

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



Re: [appengine-java] Re: Problem Authenticating against App Engine

2011-02-06 Thread Fabrizio Accatino
I follow another way:
 1 - get auth token from AccountManager
 2 - try to get the auth Cookie from AppEngine
 3 - if step 2 fails, I invalidate the Auth token and restart from step 1.

My very alpha code is here:
http://fhtino.blogspot.com/2011/02/connet-android-app-to-google-app-engine.html


   Fabrizio


On Sun, Feb 6, 2011 at 8:12 PM, Sky skysoftwaredes...@googlemail.comwrote:

 One more question concerning the invalidation of the AuthToken. I read
 that it invalidates after 24h. What is when the Activity, holding the
 AuthToken (in NicksBlog the AppInfo class), ends (with finish() and
 onDestroy) and started again? In my opinion a new valid AuthToken is
 fetched every time the Appinfo class gets started.
 In this case, why do I have to invalidate the old AuthToken?



 On 6 Feb., 19:46, Sky skysoftwaredes...@googlemail.com wrote:
  thanks for the clarification!
 
  On 6 Feb., 17:16, Fabrizio Accatino fht...@gmail.com wrote:
 
   The Nick's way is the good way.
 
   My note was about OAuth. Afaik Android AccountManager class uses
   ClientLogin for authentication on App Engine.
 
   Fabrizio
 
   On Sun, Feb 6, 2011 at 5:03 PM, Sky skysoftwaredes...@googlemail.com
 wrote:
 
thanks for the answer. I will try it, as soon as my new mobile sim
card has been activated ;). In the 2.3 emulator it worked with
 another
account...
 
ClientLogin: I did not find any sample code. The best documented way
 I
found was Nick's blog. Maybe Google should provide some
 Tutorials/libs
with sample code, that demonstrates the perfect way to authenticate
an Android app with app engine using Google accounts...
 
 

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



[appengine-java] Re: How to produce a synchronized timestamp?

2011-02-06 Thread Ivan
Interesting..I wasn't expecting such a skew. What about a remote
google time service or something, I can't imagine nobody requires
synced timestamps

On Feb 6, 9:53 pm, Peter Ondruška peter.ondru...@gmail.com wrote:
 Well in that case I am a bit puzzled what shall I expect when storing two
 entities with datetime property with auto_now=true at the same time (from
 different instances). Shall I expect the datetime to differ that much? Not
 good..

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



[appengine-java] hard time modeling my database

2011-02-06 Thread Arjan
Hi all,
It seems like i am doing this the wrong way and the datastore is giving me a 
hard time making queries.
I've got a my own User class in my application and there is a Book class in 
the application.
Now the Book class has an owner and a write attribute.
@Entity
class User {
  @Id
  private String email;
}

@Entity
class Book {
   @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key key;
private User owner;
private User writer;
}

I want to search the store for all owned books (on the users myPage)
Query query = getEntityManager().createQuery(SELECT b FROM Book b WHERE 
b.owner == :owner);
query.setParameter(owner, owner);

ListBook books = query.getResultList();

Now the datastore is throwing ugly things to me like Key of parameter value 
does not have a parent.

I'm realy lost here. Could anyone explain to me how i could solve this?

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



[appengine-java] Incremental datastore backup for App Engine

2011-02-06 Thread Eurig Jones
Hi,

Just thought i'd send this note as it might be of use to some of you.
Here is a python script to execute on remote servers to backup your
GAE app datastores. It'll work with Java apps if you install the
RemoteApiServlet.

http://androidisland.blogspot.com/2011/02/datastore-inremental-backup-script-for.html

Regards,
Eurig Jones

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



Re: [appengine-java] Re: Relationships between entities of of same kind

2011-02-06 Thread JT
Didier,

Do you mean There is currently *a bug* preventing owned one-to-many
relationships *where the parent and the child are the same class*, making it
difficult to model tree structures. This will be fixed in a future release.
You can work around this by storing explicit Key values for either the
parent or children.. If so, that is a bug not a limitation.

J

On Sun, Feb 6, 2011 at 11:30 AM, Didier Durand durand.did...@gmail.comwrote:


 Hi,

 I think that it is still in the doc: see last bullet point of

 http://code.google.com/appengine/docs/java/datastore/jdo/overview.html#Unsupported_Features_of_JDO

 regards

 didier


 On Feb 6, 4:48 pm, Jan Willies j...@willies.info wrote:
  2011/2/6 Cyrille Vincey crll...@gmail.com
 
   Some time ago, relationships between entities of same kind were not
   supported by the datastore.
   This was annoying in particular when trying to movel tree structures
   (@OneToMany relationship between MyClass and MyClass).
   The datastore documentation was pretty clear about this.
 
   I cannot find this limitation in the datastore documentation anymore.
   Have I missed a good news about a recent release allowing relationships
   inside entities of the same kind ?
 
  I tried it a few days ago (with JDO) and it didn't work.

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



[appengine-java] Re: hard time modeling my database

2011-02-06 Thread WillSpecht
You want to store the Key of the User not the actual User.  If you
store the User you are creating an owned relationship.  This means
that the user can only be owned by one book.  What you want is an
unowned relationship, which means storing the keys.  Then your query
stays the same except you will need to add query.import(import Key)
--- not the exact syntax

On Feb 6, 5:04 pm, Arjan arjan.br...@gmail.com wrote:
 Hi all,
 It seems like i am doing this the wrong way and the datastore is giving me a
 hard time making queries.
 I've got a my own User class in my application and there is a Book class in
 the application.
 Now the Book class has an owner and a write attribute.
 @Entity
 class User {
   @Id
   private String email;

 }

 @Entity
 class Book {
    @Id
 @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Key key;
 private User owner;
 private User writer;

 }

 I want to search the store for all owned books (on the users myPage)
 Query query = getEntityManager().createQuery(SELECT b FROM Book b WHERE
 b.owner == :owner);
 query.setParameter(owner, owner);

 ListBook books = query.getResultList();

 Now the datastore is throwing ugly things to me like Key of parameter value
 does not have a parent.

 I'm realy lost here. Could anyone explain to me how i could solve this?

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