[appengine-java] Re: Question: best practice to persist medium-large data?

2010-01-27 Thread a.maza
in principle, I like to work with both, JDO and JPA. but using either
of them requires (in most cases) use of the osiv pattern, which in
turn results in using something like spring. Keeping the discussions
about request and startup performance in mind, apps on GAE shouldn't
make use of too many frameworks...

thus, I am thinking about re-designing my persistence architecture
based on JDO and Spring...



On 27 Jan., 01:40, Jeff Schnitzer j...@infohazard.org wrote:
 Here's the Objectify version of what's described in the video, capable
 of a photo-equivalent of million user fanout:

 class Album {
   �...@id Long id;
    String name;}

 class PhotoIndex {
   �...@id Long id;
   �...@parent OKeyAlbum album;
    SetOKeyPhoto photos;}

 class Photo {
   �...@id Long id;
    String caption;
    String blobStoreKey;

 }

 If you want to ask what albums are this photo in? (equivalent to
 what messages are waiting for me in the video), you query like this:

 OQueryPhotoIndex query =
 createQuery(PhotoIndex.class).filter(photos, photoKey);
 ListOKeyAlbum keys = ofy.prepareKeysOnly(query).asList();
 ListAlbum albums = ofy.get(keys);

 Jeff



 On Tue, Jan 26, 2010 at 4:08 PM, Duong BaTien duong.bat...@gmail.com wrote:
  Hi Jeff:

  I am here again and have put sometime in Objectify. Thanks for taking
  pain at different design patterns. Please let the list known your effort
  in the good idea #2, especially in the social graph set intersections
  and union.

  Duong BaTien
  DBGROUPS and BudhNet

  On Tue, 2010-01-26 at 14:19 -0800, Jeff Schnitzer wrote:
  On Mon, Jan 25, 2010 at 11:52 PM, John Patterson jdpatter...@gmail.com 
  wrote:

   This is why you configure what type of relationship is used using: 
   @Embed,
   @Entity(PARENT), @Entity(CHILD) or @Entity(INDEPENDENT)
   So you have the flexibility to choose configuration _without_ rewriting 
   your
   code.  Very important difference.

  The problem is that it *isn't* as simple as just changing an
  annotation.  Not in appengine, at any rate.  It works in the simple
  case (good for demos and sample apps), but you start to notice edge
  cases:

   * In some representations you can add a Photo to an Album in a
  transaction, in some representations you can't.
   * In some representations, multiple queries are required to fetch a
  fetch an Album containing a Photo.
   * Each representation has a completely different query syntax.

  Twig exposes the datastore Query object, which means the developer
  gets the full brunt of this exposure.

  I don't want to say that it isn't possible to build a system that
  abstracts entities into a sophisticated object graph - clearly, we
  have JDO  JPA.  What I'm saying is that the people who created JDO 
  JPA are not idiots (although I do think the creators of JDO's
  annotations are aesthetically challenged).  The reason JDO has all
  that complexity and endless configuration and query languages and
  fetch groups and proxies and detaching and whatnot is because that's
  what you need to abstract an arbitrary entity graph.

   Currently the first type of representation is not an option.  I do want 
   to
   add this as it makes very large collections that change often much more
   efficient.  When it is added you could reconfigure your data schema by
   changing a single annotation.  Such a change in Objectify would require 
   the
   developer to rewrite their entire data layer

  You can never just reconfigure your data schema with a single
  annotation, both for the reasons above and because you probably have
  real-world data to migrate.  And real-world constraints demand a
  particular schema!

  Let's actually answer the original poster's question - how do you
  model a photo album?  I hope he's still listening :-)

  The first question is how you should model it in the datastore?  I'll
  use Objectify's syntax  here because it corresponds directly to the
  datastore representation.

  Actually, let's start by describing how you SHOULDN'T model a photo album.

  -

  BAD IDEA #1:

  class Album {
      @Id Long id;
      String name;
      ListOKeyPhoto photos;
  }
  class Photo {
      @Id Long id;
      String caption;
      String blobStoreKey;    // key to GAE's blobstore
  }

  Fetching photos in an album (again, Objectify syntax but equivalent to
  the datastore operation) is:

  ListPhoto fetched = ofy.get(album.photos);

  There are two reasons why this is a bad idea:

   1) You now have a hard limit of 5,000 photos per album, established by 
  GAE.

   2) Every time you load an Album, you must load the entire set of
  Photo keys.  Want to generate a list of Album names?  You have to load
  all that key data, orders of mangitude more data than what you want.

  -

  BAD IDEA #2:

  class Album {
      @Id Long id;
      String name;
  }
  class Photo {
      @Id Long id;
      @Parent OKeyAlbum album;
      String caption;
      String blobStoreKey;
  }

  This stores the Photo with the Album 

Re: [appengine-java] Can't run the Java version of GAE.

2010-01-27 Thread Tordek

Cristian Nicanor Babula wrote:
It looks like the exception is thrown when the socket calls bind(). 
Isn't that you have the port 8080 already in use?


No service is listed as using that port.

There has been no problem using the Python version of GAE: it can 
use port 8080 with no problems, and appcfg.py seems to work 
perfectly. This problem has only appeared when I tried to use the 
Java version.


(Also, maybe unrelated: If I try t use GIJ as the Java interpreter, 
it throws an UnsupportedOperationException when trying to append to 
an AbstractList.)


--
Guillermo O. «Tordek» Freschi. Programador, Escritor, Genio Maligno.
http://tordek.com.ar :: http://twitter.com/tordek
http://www.arcanopedia.com.ar - Juegos de Rol en Argentina

--
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] Google Accounts Java API and Google Apps

2010-01-27 Thread Lucian Baciu
1. The UserService createLoginURL method accepts a authDomain String
parameter, documented as authentication domain to use. What does
this mean, what domain? Can I set it to any Google Apps domain so that
a user from that domain can sign in? And what does For trusted apps
only from the method's documentation, mean ? What is a trusted app?

2. Basically, can I use the UserService to sign in my application any
user from any Google Apps domain ?

-- 
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] java.lang.NoClassDefFoundError: Could not initialize class org.datanucleus.store.appengine.DatastoreFieldManager

2010-01-27 Thread Miroslav Genov

Hello,

7 hours after last deploy of my application I got the following exception:

java.lang.NoClassDefFoundError: Could not initialize class 
org.datanucleus.store.appengine.DatastoreFieldManager
   at 
org.datanucleus.store.appengine.query.DatastoreQuery$3.fetchFields(DatastoreQuery.java:511)
   at 
org.datanucleus.state.JDOStateManagerImpl.loadFieldValues(JDOStateManagerImpl.java:841)
   at 
org.datanucleus.state.JDOStateManagerImpl.initialiseForHollowAppId(JDOStateManagerImpl.java:284)
   at 
org.datanucleus.state.StateManagerFactory.newStateManagerForHollowPopulatedAppId(StateManagerFactory.java:116)
   at 
org.datanucleus.ObjectManagerImpl.findObjectUsingAID(ObjectManagerImpl.java:2117)
   at 
org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:522)
   at 
org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:490)
   at 
org.datanucleus.store.appengine.query.DatastoreQuery.access$300(DatastoreQuery.java:108)
   at 
org.datanucleus.store.appengine.query.DatastoreQuery$6.apply(DatastoreQuery.java:604)
   at 
org.datanucleus.store.appengine.query.DatastoreQuery$6.apply(DatastoreQuery.java:596)
   at 
org.datanucleus.store.appengine.query.LazyResult.resolveNext(LazyResult.java:94)
   at 
org.datanucleus.store.appengine.query.LazyResult.resolveAll(LazyResult.java:116)
   at 
org.datanucleus.store.appengine.query.LazyResult.size(LazyResult.java:110)
   at 
org.datanucleus.store.appengine.query.StreamingQueryResult.size(StreamingQueryResult.java:124)
   at 
com.evo.adm.contract.server.ContractDaoJdo.findAll(ContractDaoJdo.java:140)
   at 
com.evo.adm.contract.server.ContractServiceImpl.findAll(ContractServiceImpl.java:250)
   at 
com.evo.adm.contract.server.ContractServiceImpl$$EnhancerByGuice$$815fbed1.CGLIB$findAll$12(generated)
   at 
com.evo.adm.contract.server.ContractServiceImpl$$EnhancerByGuice$$815fbed1$$FastClassByGuice$$da19b7a9.invoke(generated)
   at 
com.google.inject.internal.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
   at 
com.google.inject.internal.ProxyFactory$1.intercept(ProxyFactory.java:48)


Does anyone have an idea what is causing it ?

Regards,
 Miroslav

--
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: Quick question regarding List Order

2010-01-27 Thread datanucleus
A List follows the contract of java.util.List, hence obviously
ordering should be preserved. Whether it is JDO or JPA, the whole
point of transparent persistence - people shouldn't need to know
anything about the persistence process, just use their objects as
normal.

-- 
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] Question: best practice to persist medium-large data?

2010-01-27 Thread John Patterson


On 27 Jan 2010, at 05:19, Jeff Schnitzer wrote:


although I do think the creators of JDO's
annotations are aesthetically challenged).


Ha ha fair enough.  Sorry can't respond more just yet as Im out the  
door to Koh Phangan until Monday!


I think its a good thing to have abstractions at different levels -  
thats why iBatis and Hibernate both thrive in the same domain.  Higher  
level / lower level, more work / less work.  Horses for courses.


--
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] Question about server side security

2010-01-27 Thread NMAGOCIO
I would like to develop an App that lets my Google Apps domain users
update their phone numbers for their domain Profiles.
My problem is that only a domain admin can access the Profiles API.
The flow would go something like: user signs in by GAE Apps domain
user service. On load RPC transfers user name to servlet which uses
Profiles API and hard coded domain admin account to pull user phone
numbers.

It does not do much so there is not alot of risk except the domain
admin account credentials stored on the server side. That should not
be accessible but I am concerned. Any ideas on a better way to do this
or maybe there is no reason for concern?

-- 
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: Google Accounts Java API and Google Apps

2010-01-27 Thread NMAGOCIO
When you create the App on GAE it asks if you want it to be only for a
Google Apps domain. This would only be for the Apps domain account you
are logged into GAE with. The code does not have to be specific for
the domain as the GAE userservice will know to send the sign in to the
domain's auth page not gmail.

-- 
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] Bad jpeg compression

2010-01-27 Thread Torquester
I noticed that the compression of images scaled by the image service
is very low. The resulting image size is factors higher then it would
be with reasonable jpeg compression settings. Since Google Java does
not support any of the AWT classes it is very hard to find a
workaround.

There is a feature request to add an additional quality parameter to
the image service under

http://code.google.com/p/googleappengine/issues/detail?id=2410

My questions are:

1) Does anybody know a workaround (e.g. alternative jpeg encoding
library) that works on appengine?
2) Is there a time frame when (if ever) this limitation is going to be
fixed?

PS: If you also suffer from that issue, you could give it a vote on
the URL above.

-- 
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] SMS Facility

2010-01-27 Thread Ikai L (Google)
There's no APIs natively for SMS. However, many mobile service providers
have email gateways for SMS. Here's a quick list on Wikipedia:

http://en.wikipedia.org/wiki/List_of_carriers_providing_SMS_transit

http://en.wikipedia.org/wiki/List_of_carriers_providing_SMS_transitMy
experience has been that some of these are a bit out of date and don't
always seem to deliver in a timely manner.

There are other service providers that interface directly with the carriers,
however, as far as I know most of these are not free but pay per message
services. These are ideal if you are planning on large one-to-many messaging
campaigns:

http://www.google.com/search?hl=enrlz=1C1CHMA_enUS360US360q=sms+gatewayaq=faql=aqi=g10oq=

On Tue, Jan 26, 2010 at 5:53 AM, Avis developer
sivaram.subb...@gmail.comwrote:

 Hi ,
  Thanks for seeing to this. Is there any messaging facility in google
 AppEngine for Java. Is it possible to send a message to a mobile from
 a servlet in our application deployed here. Pls reply . Thx too.

 --
 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.comgoogle-appengine-java%2bunsubscr...@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
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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: vs-accounting.appspot.com - datastore viewer error

2010-01-27 Thread Ikai L (Google)
What does you local indexes file look like? Can you post the indexes listed
in your production admin console?

On Tue, Jan 26, 2010 at 11:24 PM, aswath satrasala 
aswath.satras...@gmail.com wrote:

 Hello GAE team,
 Further observations made while testing the app.  I am not able to write
 entities to the datastore.  Upon examining the logs, I found the following
 error.

 com.veersoft.action.CreateTenantAction doCreate: 
 com.google.appengine.api.datastore.DatastoreNeedIndexException:

 no matching index found..
 datastore-index kind=SecurityGroup ancestor=true source=manual
 property name=secGrpList_INTEGER_IDX direction=asc/

 /datastore-index

 The application is fine on the local develpment server.

 -Aswath


 On Tue, Jan 26, 2010 at 8:51 PM, aswath satrasala 
 aswath.satras...@gmail.com wrote:

 Hello,
 My app-id is vs-accounting.

 I login into appengine.google.com. I choose the above application.  Then
 I click on the datastore viewer.
 I get the error

  Server Error

 A server error has occurred.

 Return to Applications screen » https://appengine.google.com/

 -Aswath


  --
 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.comgoogle-appengine-java%2bunsubscr...@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
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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] JDO - GWT - JUNIT testing examples

2010-01-27 Thread Ikai L (Google)
I'm no expert on how to unit test GWT, but in terms of testing the server,
for a unit test it probably is a better idea to simply test the servlet.
I've heard HtmlUnit is pretty good for this. Here's a guide for setting up
JUnit to work with the datastore:

http://code.google.com/appengine/docs/java/howto/unittesting.html

On Tue, Jan 26, 2010 at 7:19 AM, aswath satrasala 
aswath.satras...@gmail.com wrote:

 Hi,
 I am using GWT and JDO to write a simple create and list Employee
 application.  I got this working using TransferObjects .
 How to test the GWT asysnc calls with local datastore using Junit.

 -Aswath

 --
 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.comgoogle-appengine-java%2bunsubscr...@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
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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] 30 seconds

2010-01-27 Thread Ikai L (Google)
What's Camel? This is the only thing I was able to find on Google:

http://camel.apache.org/python.html

On Tue, Jan 26, 2010 at 9:40 PM, elwis elwest...@gmail.com wrote:

 Hi all,

 I'm playing around with the Appengine and thought about using it as an
 integration platform with Camel in the middle. However, one thing
 concerns me.

 If I'm right, my integration flow will need to be finished during this
 30s that's mentioned or be killed off?
 30s might not be enough if there are a lot of traffic and advanced
 conversions between formats.

 Regards
 Stefan

 --
 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.comgoogle-appengine-java%2bunsubscr...@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
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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: how to add field to entity

2010-01-27 Thread Rusty Wright

I think you can also use the java transient keyword to tell JDO/JPA to not 
persist it.

Andrei wrote:

Ok, i forgot to put
@NotPersistent

On Jan 26, 1:15 pm, Andrei gml...@gmail.com wrote:

Thanks, i'll try
What i do not understand, this value is not stored in db

On Jan 26, 1:06 pm, John Patterson jdpatter...@gmail.com wrote:


You could try using Boolean instead of boolean.
On 27 Jan 2010, at 00:48, Andrei wrote:

I have entity that is already stored in db
I added boolean field that i do not want to store in db, so it's not
marked as @Persistent
When retrieve existing entity from db i get exception
java.lang.NullPointerException: Datastore entity with kind Data and
key Data(mykey) has a null property named needsUpdate.  This
property is mapped to com.foo.Data.needsUpdate, which cannot accept
null values.
What did i do wrong?
--  
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 
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.



Re: [appengine-java] Not allowed to access system class loader.

2010-01-27 Thread Ikai L (Google)
Is this preventing your task from running? This is generally a harmless
exception. Here's another thread on the subject, though your stack trace is
a bit different:

http://groups.google.com/group/google-appengine-java/browse_thread/thread/e01814b8ceaf3e59/b340b4de766e09fb?lnk=gstq=FinalizableReferenceQueue+app+engine#b340b4de766e09fb

On Tue, Jan 26, 2010 at 5:02 PM, ravi guntuku
ravikumar.gunt...@gmail.comwrote:

 A simple servlet which reads some data from a table - and query
 analytics service and store data in another table.  When i run this
 servlet from browser it works (always). I have scheduled this servlet
 to run as cron job and it is not working at all. And i see the below
 exception in App engine logs.

 01-26 04:36PM 45.184

 com.google.appengine.repackaged.com.google.common.base.FinalizableReferenceQueue
 $SystemLoader loadFinalizer: Not allowed to access system class
 loader.
 I 01-26 04:36PM 45.197
 com.google.appengine.repackaged.com.google.common.base.internal.Finalizer
 getInheritableThreadLocalsField: Couldn't access
 Thread.inheritableThreadLocals. Reference finalizer threads will
 inherit thread local values.
 I 01-26 04:36PM 45.201

 com.google.appengine.repackaged.com.google.common.base.FinalizableReferenceQueue
 init: Failed to start reference finalizer thread. Reference cleanup
 will only occur when new references are created.
 java.lang.reflect.InvocationTargetException
at com.google.appengine.runtime.Request.process-51100059fa394f2b
 (Request.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:42)
at

 com.google.appengine.repackaged.com.google.common.base.FinalizableReferenceQueue.init
 (FinalizableReferenceQueue.java:124)
at
 com.google.appengine.repackaged.com.google.common.labs.misc.InterningPools
 $WeakInterningPool.clinit(InterningPools.java:104)
at

 com.google.appengine.repackaged.com.google.common.labs.misc.InterningPools.newWeakInterningPool
 (InterningPools.java:48)
at

 com.google.appengine.repackaged.com.google.io.protocol.ProtocolSupport.clinit
 (ProtocolSupport.java:55)
at com.google.apphosting.api.DatastorePb$Query.init
 (DatastorePb.java:1072)
at com.google.apphosting.api.DatastorePb$Query$1.init
 (DatastorePb.java:2529)
at com.google.apphosting.api.DatastorePb$Query.clinit
 (DatastorePb.java:2529)
at com.google.appengine.api.datastore.QueryTranslator.convertToPb
 (QueryTranslator.java:28)
at com.google.appengine.api.datastore.DatastoreServiceImpl
 $PreparedQueryImpl.convertToPb(DatastoreServiceImpl.java:424)
at com.google.appengine.api.datastore.DatastoreServiceImpl
 $PreparedQueryImpl.runQuery(DatastoreServiceImpl.java:384)
at com.google.appengine.api.datastore.DatastoreServiceImpl
 $PreparedQueryImpl.asQueryResultIterator(DatastoreServiceImpl.java:
 358)
at com.google.appengine.api.datastore.DatastoreServiceImpl
 $PreparedQueryImpl$2.iterator(DatastoreServiceImpl.java:338)
at com.google.appengine.api.datastore.DatastoreServiceImpl
 $PreparedQueryImpl$2.iterator(DatastoreServiceImpl.java:336)
at

 org.datanucleus.store.appengine.query.RuntimeExceptionWrappingIterable.iterator
 (RuntimeExceptionWrappingIterable.java:42)
at org.datanucleus.store.appengine.query.LazyResult.init
 (LazyResult.java:67)
at org.datanucleus.store.appengine.query.StreamingQueryResult.init
 (StreamingQueryResult.java:63)
at

 org.datanucleus.store.appengine.query.DatastoreQuery.newStreamingQueryResultForEntities
 (DatastoreQuery.java:399)
at
 org.datanucleus.store.appengine.query.DatastoreQuery.wrapEntityQueryResult
 (DatastoreQuery.java:372)
at
 org.datanucleus.store.appengine.query.DatastoreQuery.fulfillEntityQuery
 (DatastoreQuery.java:364)
at org.datanucleus.store.appengine.query.DatastoreQuery.executeQuery
 (DatastoreQuery.java:265)
at
 org.datanucleus.store.appengine.query.DatastoreQuery.performExecute
 (DatastoreQuery.java:228)
at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute
 (JDOQLQuery.java:85)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
at org.datanucleus.store.query.Query.executeWithArray(Query.java:
 1371)
at org.datanucleus.store.query.Query.execute(Query.java:1344)
at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:221)
at sample.data.SaveGoogleData.saveData(SaveGoogleData.java:53)
at
 sample.controller.DataStoreServlet.doGet(DataStoreServlet.java:21)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at
 org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
 487)
   

Re: [appengine-java] Re: One-to-many querying for a child instance

2010-01-27 Thread Rusty Wright

Do you need a colon in front of nameParam?

   query.setFilter(name == :nameParam);


Sydney wrote:

The query returns no result.

ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment
());
ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(.))
{
});
A a = new A(A);
B b = new B(B);
a.getBs().add(b);
PersistenceManagerFactory pmf =
JDOHelper.getPersistenceManagerFactory(transactions-optional);
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
pm.makePersistent(a);
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
}

System.out.println(a.getKey());
A ap = pm.getObjectById(A.class, A);
System.out.println(ap.getKey());
Query query = pm.newQuery(B.class);
query.setFilter(name == nameParam);
query.declareParameters(String nameParam);
ListB rs = (ListB) query.execute(B);
System.out.println(rs.size());


On Jan 23, 12:20 am, John Patterson jdpatter...@gmail.com wrote:
Execute a query on the name property of B rather than loading it by  
key.  If the name is unique the result should only contain one B.


On 23 Jan 2010, at 11:41,Sydneywrote:




I have a one to many relationship. There is a problem in the way I
query for a B object. I was wondering what is the best way (most
efficient) to do that.
A a = new A(A);
B b = new B(B);
a.getBs().add(b);
pm.makePersistent(a); // it's done inside a transaction
A ap = pm.getObjectById(A.class, A); // FINE
B bp = pm.getObjectById(B.class, B); // NOT FOUND Exception
I guess B is not found because the real key is not B but B + A key.
How do you get the B object when you don't know nothing about A?
public class A {
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   @Extension(vendorName = datanucleus, key = gae.encoded-pk,
value = true)
   private String key;
   @Persistent
   @Extension(vendorName = datanucleus, key = gae.pk-name, value
= true)
   private String name;
   @Persistent(mappedBy = a)
   private ListB bs;
   public A(String name) {
   this.name = name;
   bs = new ArrayListB();
   }
... Getter/Setter
}
@PersistenceCapable(identityType =
javax.jdo.annotations.IdentityType.APPLICATION)
public class B {
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   @Extension(vendorName = datanucleus, key = gae.encoded-pk,
value = true)
   private String key;
   @Persistent
   @Extension(vendorName = datanucleus, key = gae.pk-name, value
= true)
   private String name;
   @Persistent
   private A a;
   public B(String name) {
   this.name = name;
   }
... Getter/Setter
}
--
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 
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] Trouble with Consuming Web Service from a Background Thread.

2010-01-27 Thread Viji Sarathy
Hi,

I am trying to consume a REStful web service from my web application
that is deployed under the App Engine.
I am using the Jersey framework in order to make the web service call
and I followed the steps outlined in this tutorial:
http://blogs.sun.com/enterprisetechtips/entry/consuming_restful_web_services_with.
I need to call this web service periodically and gather data which is
then entered into the App Engine data store.

The following is what I do:

In have an instance of  javax.servlet.ServletContextListener which is
called upon the application start up. It spins up a background thread
by calling the start() method on an instance of a class that extends
java.lang.Thread. Then, inside the run() method of the class that
extends Thread, I have the code for calling the web service. Here's
that code. Below, the classes Client, ClientConfig,
DefaultClientConfig and WebResource are all from the Jersey framework.

try
{
ClientConfig config = new DefaultClientConfig ();
Client client = Client.create (config);
WebResource webResource = client.resource 
(http://www.iobridge.com/
interface/feed/FD_0BosKdymNbB3LyiFYUVI);
String response = webResource.accept 
(application/json).get
(String.class);
}
catch (Exception ex)
{
}


Here's my problem:

When I execute this code on a background thread, I get a
NullPointerException. However, if I execute it, say, in the
ServletContextListener's contextInitialized() method, then it works
fine. What is causing this to happen?

I repeated this experiment by trying to make an HTTP GET request using
plain old Java classes in the java.net package, that is, using the URL
and URLConnection classes.

URL url = new URL (http://www.iobridge.com/interface/feed/
FD_0BosKdymNbB3LyiFYUVI);
URLConnection connection = url.openConnection ();
connection.setDoOutput (true);
connection.setRequestProperty (Content-Type, application/json);
BufferedReader in = new BufferedReader (new InputStreamReader
(connection.getInputStream ()));


Here too, the code does not work on a background thread but works OK
elsewhere.

Is the usage of background threads the primary cause here?

Thanks,
Viji




-- 
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] User authentication

2010-01-27 Thread Sreeja Gautam
Hi,
Am new to GAE. I want to build an application on GAE that stores data from
multiple companies. I would like to get advice on what would be the best
approach ..
1) To host the application in different domains - one for each company?
2) to host the application in one domain and use the
authentication/authorization provided in GAE to show the relevant data to
the users? A gmail account may not have company information for a person..
3) build the authentication/authorization mechanism into my application?
Kindly advice.
Thanks!
Sree

-- 
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] Can't get JUnit to test making a JDO object persistent

2010-01-27 Thread Will Bunker
I originally posted this on General discussion, not realizing there is
a Java specific group, so I am sorry for the redundancy:

I have gotten the basic setup recommended in the docs.  I am able to
query the database successfully but as soon as I attempt to persists a
JDO object I get a can't find annotations error.  The code is simply:

public class UserTestCase extends LocalDatastoreTestCase {

public void testDatesBeingSetOnCreate() {

User user = new User(w...@thebunkers.com, mypassword);

//DatastoreServiceFactory.getDatastoreService().put(user);

PersistenceManager manager = newPersistenceManager();
manager.makePersistent(user);
manager.close();

Query query = new Query(User.class.getSimpleName());
assertEquals(1, DatastoreServiceFactory.getDatastoreService
().prepare(query).countEntities());
}

}

The error occurs at the makePersistent call.  If I comment it out the
test runs fine except of course there is no user on the assert line.

The error is:

org.datanucleus.jdo.exceptions.NoPersistenceInformationException: The
class The class com.sootra.shared.User is required to be
persistable yet no Meta-Data/Annotations can be found for this class.
Please check that the Meta-Data/annotations is defined in a valid file
location. is required to be persistable yet no Meta-Data can be found
for this class. Please check that the Meta-Data is defined in a valid
file location for JDO.

I am able to run the create user fine when running the app locally, as
well as uploading it to app engine.  So the code is fine, but I am
unable to get JUnit test to recognize where the MetaData is being
created by the enhancer.

Has anyone successfully gotten this to run in Eclipse.  I am guessing
that I am missing some classpath setting or meta information, but can
not find any references anywhere on the net yet.

-- 
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] Can't operate on multiple entity groups when reading

2010-01-27 Thread BarberNet
Getting error message

NestedThrowablesStackTrace:
java.lang.IllegalArgumentException: can't operate on multiple entity
groups in a single transaction. found both Element {
  type: Book
  id: 2
}
 and Element {
  type: Book
  id: 4
}

fails on the line
 BookService : book.getPage(); as each book is in a separate
entity group

but why does it not fail on
Book book = bookmark.getBook();? as each bookmark is also in a
separate entity group.

@Test
public void listTwoBooksBySingleUser() {
User user = new User(jo...@vegas.com, test auth domain, 
1234);
userService.save(user);
Book book1 = new Book();
book1.setTitle(test book title 1);
bookService.save(book1);
Book book2 = new Book();
book2.setTitle(test book title 2);
bookService.save(book2);

bookService.createBookmarkForUser(book1, user);
bookService.createBookmarkForUser(book2, user);

ListBook books = bookService.listByUser(user);
assertEquals(2,books.size());
assertEquals(test book title 1, books.get(0).getTitle());
assertEquals(test book title 2, books.get(1).getTitle());
}

public class BookService {

public ListBook listByUser(User user) {
Query query = em.createQuery(SELECT bm FROM 
+Bookmark.class.getName
()+ bm WHERE bm.userKeys = :userKey);
query.setParameter(userKey, user.getKey());
ListBookmark bookmarks = query.getResultList();

ListBook books = new ArrayListBook();
for (Bookmark bookmark : bookmarks) {
Book book = bookmark.getBook();
book.getPage();
books.add(book);
}
return books;
}
}

-- 
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: Question: best practice to persist medium-large data?

2010-01-27 Thread Jeff Schnitzer
On Wed, Jan 27, 2010 at 2:44 AM, datanucleus andy_jeffer...@yahoo.com wrote:

 Exposing Key to a user is not (in my opinion) a requirement for
 *providing* a JDO impl on GAE/J. Other datastores have their own
 internal id and we don't expose theirs (e.g db4o).
...
 And, of course, all of that (endless) configuration is optional. There
 is very little that is mandatory, like declaring what class(es) can be
 persisted. Evidently, at some point, you're going to actually define
 *what* is aesthetically displeasing about JDO annotations, and you
 could do that with reference to JPA annotations too (where you'll find
 many many more annotations, and with delightfully RDBMS specific names
 too) :-) Such annotations obviously had to provide backwards
 compatibility naming with JDO 1.0 and JDO 2.0 specs, and as the saying
 goes, if you think you can do better ...

Going back to the original poster's request, would you like to provide
JDO (on GAE/J) equivalents of the annotated entities that described in
BAD IDEA #1, BAD IDEA #2, and GOOD IDEA?  That is:

 1) A one-to-many relationship stored as a Photo key array in the Album entity
 2) A one-to-many relationship stored as an Album key in the Photo's key parent
 3) A one-to-many relationship stored as an Album key property in a Photo entity

(The BAD IDEAS are bad for a photo album app, but they are perfectly
good ideas in other apps so they're quite relevant to this
discussion).

Aesthetics are of course subjective, but you're handicapped right out
of the gate when the first few lines of code look like this (taken
from the first full example class of Defining Data Classes in the
GAE/J docs):

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

I'm sure there are perfectly good historical reasons for why things
are the way they are, but nevertheless the accumulated load of
oddly-named things and inconsistent placement makes the learning curve
excruciating.  Why do I define the identity type in these other
annotations and not in @PrimaryKey??

JPA is a little better with @Entity and @Id, but you will have a hard
time finding someone that wouldn't rather read and type the Objectify
version:

public class Employee {
@Id Long id;


(@Entity is unnecessary)

Jeff

-- 
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] Trouble with Consuming Web Service from a Background Thread.

2010-01-27 Thread Ikai L (Google)
You won't be able to create a thread in App Engine. It's strange that you're
getting a NullPointerException, however. This is documented here:

http://code.google.com/appengine/docs/java/overview.html

On Wed, Jan 27, 2010 at 12:53 PM, Viji Sarathy viji.sara...@gmail.comwrote:

 Hi,

 I am trying to consume a REStful web service from my web application
 that is deployed under the App Engine.
 I am using the Jersey framework in order to make the web service call
 and I followed the steps outlined in this tutorial:

 http://blogs.sun.com/enterprisetechtips/entry/consuming_restful_web_services_with
 .
 I need to call this web service periodically and gather data which is
 then entered into the App Engine data store.

 The following is what I do:

 In have an instance of  javax.servlet.ServletContextListener which is
 called upon the application start up. It spins up a background thread
 by calling the start() method on an instance of a class that extends
 java.lang.Thread. Then, inside the run() method of the class that
 extends Thread, I have the code for calling the web service. Here's
 that code. Below, the classes Client, ClientConfig,
 DefaultClientConfig and WebResource are all from the Jersey framework.

try
{
ClientConfig config = new DefaultClientConfig ();
Client client = Client.create (config);
WebResource webResource = client.resource (
 http://www.iobridge.com/
 interface/feed/FD_0BosKdymNbB3LyiFYUVI);
String response = webResource.accept
 (application/json).get
 (String.class);
}
catch (Exception ex)
{
}


 Here's my problem:

 When I execute this code on a background thread, I get a
 NullPointerException. However, if I execute it, say, in the
 ServletContextListener's contextInitialized() method, then it works
 fine. What is causing this to happen?

 I repeated this experiment by trying to make an HTTP GET request using
 plain old Java classes in the java.net package, that is, using the URL
 and URLConnection classes.

 URL url = new URL (http://www.iobridge.com/interface/feed/
 FD_0BosKdymNbB3LyiFYUVI);
 URLConnection connection = url.openConnection ();
 connection.setDoOutput (true);
 connection.setRequestProperty (Content-Type, application/json);
 BufferedReader in = new BufferedReader (new InputStreamReader
 (connection.getInputStream ()));


 Here too, the code does not work on a background thread but works OK
 elsewhere.

 Is the usage of background threads the primary cause here?

 Thanks,
 Viji




 --
 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.comgoogle-appengine-java%2bunsubscr...@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
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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't get JUnit to test making a JDO object persistent

2010-01-27 Thread Will Bunker
Also turned on logging of the  Datanucleus to the finest level and am
getting the following:


Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
setProperty
INFO: Property datanucleus.rdbms.sql.allowAllSQLStatements unknown -
will be ignored
Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
setProperty
INFO: Property datanucleus.rdbms.stringDefaultLength unknown - will be
ignored
Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
setProperty
INFO: Property datanucleus.appengine.autoCreateDatastoreTxns unknown -
will be ignored
Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
logConfiguration
INFO: = Persistence Configuration ===
Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
logConfiguration
INFO: DataNucleus Persistence Factory - Vendor: DataNucleus
Version: 1.1.5
Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
logConfiguration
INFO: DataNucleus Persistence Factory initialised for datastore
URL=appengine driver= userName=
Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
logConfiguration
INFO: ===
Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
setProperty
INFO: Property datanucleus.query.cached unknown - will be ignored
Jan 27, 2010 2:00:08 PM
org.datanucleus.jdo.metadata.JDOMetaDataManager init
INFO: Registering listener for metadata initialisation
Jan 27, 2010 2:00:08 PM org.datanucleus.jdo.metadata.JDOMetaDataManager
$MetaDataRegisterClassListener registerClass
INFO: Listener found initialisation for persistable class
com.sootra.shared.User
Jan 27, 2010 2:00:08 PM
org.datanucleus.jdo.metadata.JDOAnnotationReader
processClassAnnotations
INFO: Class com.sootra.shared.User has been specified with JDO
annotations so using those.
Jan 27, 2010 2:00:08 PM
org.datanucleus.store.appengine.MetaDataValidator validate
INFO: Performing appengine-specific metadata validation for
com.sootra.shared.User
Jan 27, 2010 2:00:08 PM
org.datanucleus.store.appengine.MetaDataValidator validate
INFO: Finished performing appengine-specific metadata validation for
com.sootra.shared.User
Jan 27, 2010 2:00:08 PM org.datanucleus.store.StoreDataManager
registerStoreData
INFO: Managing Persistence of Class : com.sootra.shared.User [Table :
(none), InheritanceStrategy : subclass-table]
Jan 27, 2010 2:00:08 PM org.datanucleus.store.StoreDataManager
registerStoreData
INFO: Managing Persistence of Class : com.sootra.shared.User [Table :
(none), InheritanceStrategy : subclass-table]

So it seems to be running the metadata validation but then can't find
the enhanced information???

-- 
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] problem with documentation

2010-01-27 Thread Rusty Wright

When I'm learning something new one of the things that slows me down is poor 
documentation.  I think the app engine java documentation Storing Data could be 
improved if it used consistent terminology in the area of entity groups, which 
is a crucial part of understanding how the data store works.

Sometimes the documentation uses the terms owned and unowned relationships, 
sometimes the terms parent and child.  I'm thinking that the owned and unowned 
terms aren't the best choice since you can't use them to say anything about a 
child.  To my way of thinking an owned relationship is a parented relationship. 
 But then you can't say that an unowned relationship is an unparented 
relationship since the owned entity could have a parent.  Perhaps you could 
call it a nonparented relationship?  Or maybe a nonparenting relationship?

Overall I much prefer the terms parent and child; the data is stored with a 
tree structure and parent and child are the natural terms when talking about 
trees.  I also think that if the terms parent and child were used instead of 
owned (and unowned) that it could help people more quickly understand that the 
structure in the data store is a tree.

--
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't get JUnit to test making a JDO object persistent

2010-01-27 Thread Will Bunker
Here they are:


/**
 * Convenience method: gets a new PersistenceManager
 */
public PersistenceManager newPersistenceManager() {
  return this.getPersistenceManagerFactory()
  .getPersistenceManager();
}

/**
 * Gets the PersistenceManagerFactory that was created by
 * this Initializer.
 */
public PersistenceManagerFactory getPersistenceManagerFactory() {
  if (pmf == null) {

Logger.getLogger(DataNucleus.JDO).setLevel(Level.FINEST);
Logger.getLogger(DataNucleus.JPA).setLevel(Level.FINEST);
Logger.getLogger(DataNucleus.Persistence).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Query).setLevel(Level.FINEST);
Logger.getLogger(DataNucleus.Lifecycle).setLevel(Level.FINEST);
Logger.getLogger(DataNucleus.Reachability).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Cache).setLevel(Level.FINEST);
Logger.getLogger(DataNucleus.ClassLoading).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.MetaData).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Management).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.General).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Connection).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.JCA).setLevel(Level.FINEST);
Logger.getLogger(DataNucleus.Transaction).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Plugin).setLevel(Level.OFF);
Logger.getLogger(DataNucleus.ValueGeneration).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Datastore).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Datastore.Schema).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Datastore.Persist).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Datastore.Retrieve).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Datastore.Native).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.Enhancer).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.SchemaTool).setLevel
(Level.FINEST);
Logger.getLogger(DataNucleus.IDE).setLevel(Level.FINEST);


Properties newProperties = new Properties();
newProperties.put(javax.jdo.PersistenceManagerFactoryClass,
 
org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory);
newProperties.put
(javax.jdo.option.ConnectionURL,appengine);
newProperties.put(javax.jdo.option.NontransactionalRead,
true);
newProperties.put(javax.jdo.option.NontransactionalWrite,
true);
newProperties.put(javax.jdo.option.RetainValues,true);
newProperties.put
(datanucleus.appengine.autoCreateDatastoreTxns,true);
pmf = JDOHelper.getPersistenceManagerFactory(newProperties);
  }
  return pmf;
}


@PersistenceCapable(identityType = IdentityType.APPLICATION)
@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public class User implements PersistHooks {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;

@Persistent
private Email email;

@Persistent
private String user_type;


@Persistent
private String password;

@Persistent
private Date create_time;

@Persistent
private Date create_date;

@Persistent
private Date update_time;

@Persistent
private Date update_date;

@SuppressWarnings(deprecation)
public void beforeSave() {
if (this.create_date == null) {
this.create_time = new Date();
this.create_date = new Date(create_time.getYear(),
create_time.getMonth(), create_time.getDate());
}
this.update_time = new Date();
this.update_date = new Date(update_time.getYear(),
update_time.getMonth(), update_time.getDate());
}

public void afterLoad() {}

public User(String email, String password) {
this.email = new Email(email);
this.password = password;
}

public User() {

}

public Key getKey() {
return key;
}

public void setKey(Key key) {
this.key = key;
}

public Email getEmail() {
return email;
}

public void setEmail(Email email) {
this.email = email;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public Date getCreate_time() {
return create_time;
}

public void setCreate_time(Date createTime) {
create_time = createTime;
}

public Date getCreate_date() {
return create_date;
}

public 

[appengine-java] Re: Question: best practice to persist medium-large data?

2010-01-27 Thread datanucleus
 Going back to the original poster's request, would you like to provide
 JDO (on GAE/J) equivalents of the annotated entities that described in
 BAD IDEA #1, BAD IDEA #2, and GOOD IDEA?  That is:

I only represent JDO, as a spec, not how GAE/J have implemented it.
The docs for that are provided in the JDO spec and on the DataNucleus
website. I fail to see anything controversial in how they are
represented in those places. I've already made my feelings well enough
known on exposing environment specific classes into user space

 Aesthetics are of course subjective, but you're handicapped right out
 of the gate when the first few lines of code look like this (taken
 from the first full example class of Defining Data Classes in the
 GAE/J docs):

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

So how GAE/J present them ? Not how DataNucleus present them in our
docs then?
No need to specify identityType=IdentityType.APPLICATION since the
user provides a primary key. You need an annotation of some form to
say your class is persistent, and one to say that this is a PK field,
and it has a generated value.
You define the valueStrategy not in @PrimaryKey because in JDO you can
generate a value into *any* field not just in a PK. JDO provides
flexibility in that respect, something to be pleased about.

 JPA is a little better with @Entity and @Id

And you forgot @GeneratedValue to get the equivalent thing, so not
really any different. So you have shorter names, but then you have an
IDE too that adds them with completion, so what difference is that?

Either way, if you think you can make some improvements and really
want to effect a standard then the Apache JDO group is waiting to hear
from 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.



Re: [appengine-java] Getting the size of a http request?

2010-01-27 Thread Ikai L (Google)
Are there places where this isn't reliably set? In my servlet I am calling:

int contentLength = request.getContentLength();

This works with the following form:

form action=/content_length method=POST enctype=multipart/form-data
input type=file name=somefile /
input type=text name=sometext /
input type=submit /
/form

On Mon, Jan 25, 2010 at 3:46 AM, armanuj arama...@gmail.com wrote:

 Hello,

 How can one get the byte size of a http request, esp. in the context
 of a Java servlet being used in the Google app. engine? Is there a way
 to do this where the 'Content-Length' is not set (or not reliably set)
 in the get/post headers?

 Appreciate your help in this.

 Thanks,
 Arun

 --
 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.comgoogle-appengine-java%2bunsubscr...@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
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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't get JUnit to test making a JDO object persistent

2010-01-27 Thread Will Bunker
I was wrong with my initial analysis.  I had assumed because a
subclass was persisting that the super class would also.  When I try
and add a User I get the meta/data missing also in local environment.

I have narrowed it down to one line which triggers the problem:

@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public class User implements PersistHooks {


when I take out the @Inheritance then it finds the meta-data for the
user class.  Is this a feature or a bug??

-- 
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: One-to-many querying for a child instance

2010-01-27 Thread Sydney
Since I declared the parameter with query.declareParameters(String
nameParam);, the colon is not valid. As expected I got an exception
org.datanucleus.store.query.QueryCompilerSyntaxException: Explicit
parameters defined for query, yet implicit parameter syntax
(:nameParam) found

On Jan 27, 4:39 pm, Rusty Wright rwright.li...@gmail.com wrote:
 Do you need a colon in front of nameParam?

             query.setFilter(name == :nameParam);



 Sydneywrote:
  The query returns no result.

              ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment
  ());
              ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(.))
  {
              });
              A a = new A(A);
              B b = new B(B);
              a.getBs().add(b);
              PersistenceManagerFactory pmf =
  JDOHelper.getPersistenceManagerFactory(transactions-optional);
              PersistenceManager pm = pmf.getPersistenceManager();
              Transaction tx = pm.currentTransaction();
              try {
                  tx.begin();
                  pm.makePersistent(a);
                  tx.commit();
              } finally {
                  if (tx.isActive()) {
                      tx.rollback();
                  }
              }

              System.out.println(a.getKey());
              A ap = pm.getObjectById(A.class, A);
              System.out.println(ap.getKey());
              Query query = pm.newQuery(B.class);
              query.setFilter(name == nameParam);
              query.declareParameters(String nameParam);
              ListB rs = (ListB) query.execute(B);
              System.out.println(rs.size());

  On Jan 23, 12:20 am, John Patterson jdpatter...@gmail.com wrote:
  Execute a query on the name property of B rather than loading it by  
  key.  If the name is unique the result should only contain one B.

  On 23 Jan 2010, at 11:41,Sydneywrote:

  I have a one to many relationship. There is a problem in the way I
  query for a B object. I was wondering what is the best way (most
  efficient) to do that.
  A a = new A(A);
  B b = new B(B);
  a.getBs().add(b);
  pm.makePersistent(a); // it's done inside a transaction
  A ap = pm.getObjectById(A.class, A); // FINE
  B bp = pm.getObjectById(B.class, B); // NOT FOUND Exception
  I guess B is not found because the real key is not B but B + A key.
  How do you get the B object when you don't know nothing about A?
  public class A {
    �...@primarykey
    �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    �...@extension(vendorName = datanucleus, key = gae.encoded-pk,
  value = true)
     private String key;
    �...@persistent
    �...@extension(vendorName = datanucleus, key = gae.pk-name, value
  = true)
     private String name;
    �...@persistent(mappedBy = a)
     private ListB bs;
     public A(String name) {
         this.name = name;
         bs = new ArrayListB();
     }
  ... Getter/Setter
  }
  @PersistenceCapable(identityType =
  javax.jdo.annotations.IdentityType.APPLICATION)
  public class B {
    �...@primarykey
    �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    �...@extension(vendorName = datanucleus, key = gae.encoded-pk,
  value = true)
     private String key;
    �...@persistent
    �...@extension(vendorName = datanucleus, key = gae.pk-name, value
  = true)
     private String name;
    �...@persistent
     private A a;
     public B(String name) {
         this.name = name;
     }
  ... Getter/Setter
  }
  --
  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 
  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] Re: One-to-many querying for a child instance

2010-01-27 Thread Sydney
I used an extent to verify that a B with a B name exists.

ExtentB e = pm.getExtent(B.class);
IteratorB it = e.iterator();
while (it.hasNext()) {
B rsb = it.next();
System.out.println(rsb.getName());
System.out.println(rsb.getKey());
}
e.closeAll();

The output:

B
agR0ZXN0chALEgFBIgFBDAsSAUIiAUIM

On Jan 27, 6:41 pm, Sydney sydney.henr...@gmail.com wrote:
 Since I declared the parameter with query.declareParameters(String
 nameParam);, the colon is not valid. As expected I got an exception
 org.datanucleus.store.query.QueryCompilerSyntaxException: Explicit
 parameters defined for query, yet implicit parameter syntax
 (:nameParam) found

 On Jan 27, 4:39 pm, Rusty Wright rwright.li...@gmail.com wrote:



  Do you need a colon in front of nameParam?

              query.setFilter(name == :nameParam);

  Sydneywrote:
   The query returns no result.

               ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment
   ());
               ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(.))
   {
               });
               A a = new A(A);
               B b = new B(B);
               a.getBs().add(b);
               PersistenceManagerFactory pmf =
   JDOHelper.getPersistenceManagerFactory(transactions-optional);
               PersistenceManager pm = pmf.getPersistenceManager();
               Transaction tx = pm.currentTransaction();
               try {
                   tx.begin();
                   pm.makePersistent(a);
                   tx.commit();
               } finally {
                   if (tx.isActive()) {
                       tx.rollback();
                   }
               }

               System.out.println(a.getKey());
               A ap = pm.getObjectById(A.class, A);
               System.out.println(ap.getKey());
               Query query = pm.newQuery(B.class);
               query.setFilter(name == nameParam);
               query.declareParameters(String nameParam);
               ListB rs = (ListB) query.execute(B);
               System.out.println(rs.size());

   On Jan 23, 12:20 am, John Patterson jdpatter...@gmail.com wrote:
   Execute a query on the name property of B rather than loading it by  
   key.  If the name is unique the result should only contain one B.

   On 23 Jan 2010, at 11:41,Sydneywrote:

   I have a one to many relationship. There is a problem in the way I
   query for a B object. I was wondering what is the best way (most
   efficient) to do that.
   A a = new A(A);
   B b = new B(B);
   a.getBs().add(b);
   pm.makePersistent(a); // it's done inside a transaction
   A ap = pm.getObjectById(A.class, A); // FINE
   B bp = pm.getObjectById(B.class, B); // NOT FOUND Exception
   I guess B is not found because the real key is not B but B + A key.
   How do you get the B object when you don't know nothing about A?
   public class A {
     �...@primarykey
     �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     �...@extension(vendorName = datanucleus, key = gae.encoded-pk,
   value = true)
      private String key;
     �...@persistent
     �...@extension(vendorName = datanucleus, key = gae.pk-name, value
   = true)
      private String name;
     �...@persistent(mappedBy = a)
      private ListB bs;
      public A(String name) {
          this.name = name;
          bs = new ArrayListB();
      }
   ... Getter/Setter
   }
   @PersistenceCapable(identityType =
   javax.jdo.annotations.IdentityType.APPLICATION)
   public class B {
     �...@primarykey
     �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     �...@extension(vendorName = datanucleus, key = gae.encoded-pk,
   value = true)
      private String key;
     �...@persistent
     �...@extension(vendorName = datanucleus, key = gae.pk-name, value
   = true)
      private String name;
     �...@persistent
      private A a;
      public B(String name) {
          this.name = name;
      }
   ... Getter/Setter
   }
   --
   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 
   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.



Re: [appengine-java] Question: best practice to persist medium-large data?

2010-01-27 Thread Duong BaTien
Thanks Jeff.

There seems to be something at odd:

On Tue, 2010-01-26 at 16:40 -0800, Jeff Schnitzer wrote:
 Here's the Objectify version of what's described in the video, capable
 of a photo-equivalent of million user fanout:
 
 class Album {
@Id Long id;
String name;
 }
 class PhotoIndex {
@Id Long id;
@Parent OKeyAlbum album;
SetOKeyPhoto photos;
 }
 class Photo {
@Id Long id;
String caption;
String blobStoreKey;
 }
 
 If you want to ask what albums are this photo in? (equivalent to
 what messages are waiting for me in the video), you query like this:
 
 OQueryPhotoIndex query =
 createQuery(PhotoIndex.class).filter(photos, photoKey);
 ListOKeyAlbum keys = ofy.prepareKeysOnly(query).asList();
 ListAlbum albums = ofy.get(keys);
 
 Jeff
 

In the above query to ask what albums are this photo in, I wonder if it
is legitimate to cast List of PhotoIndex keys with ListOKeyAlbum so
you can get a particular photoKey in a list of albums.

Using the same structure for User, MessageIndex and Message, the query
seems to ask for a list of users, a particular message is sent to?


class User {
   @Id Name userId;
}
class MessageIndex {
   @Id Long messageIndexId;
   @Parent OKeyUser userKey;
   ListOKeyMessage messageKeys;
}
class Message {
   @Id Long messageId;
   String ccontent;
}

To query the list of users a particular messageKey is sent to:

OQueryMessageIndex query =
ObjectifyService.createQuery(MessageIndex.class).filter(messageKeys,
messageKey);
ListOKeyUser userKeys = ofy.prepareKeysOnly(query).asList();
ListUser users = ofy.get(userKeys);

To query what messages are waiting for me:

OQueryMessageIndex query = ObjectifyService.createQuery
(MessageIndex.class).filter(userKey, meKey);
ListOKeyMessage listOfMessageKeys = ofy.prepareKeysOnly
(query).asList();
// iterate through listOfMessageKeys and each iteration, get a batch of
messages sent to meKey?

Can GQL of python be used in Objectify?

Thanks
Duong BaTien
DBGROUPS and BudhNet



-- 
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't get JUnit to test making a JDO object persistent

2010-01-27 Thread Will Bunker
Realize that I totally misunderstood the @inheritance properties.  I
was assuming that all subclasses would be store in super class, but
realize that it is the opposite.  So there is no actual meta data
being generated for the user table, but all the fields are put in the
metadata for subclass.

On Jan 27, 3:40 pm, Will Bunker w...@thebunkers.com wrote:
 I was wrong with my initial analysis.  I had assumed because a
 subclass was persisting that the super class would also.  When I try
 and add a User I get the meta/data missing also in local environment.

 I have narrowed it down to one line which triggers the problem:

 @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
 public class User implements PersistHooks {

 when I take out the @Inheritance then it finds the meta-data for the
 user class.  Is this a feature or a bug??

-- 
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: Can't get JUnit to test making a JDO object persistent

2010-01-27 Thread Ikai L (Google)
I'm not entirely sure what you're doing with inheritance, but does this open
issue help?

http://code.google.com/p/datanucleus-appengine/issues/detail?id=25

On Wed, Jan 27, 2010 at 5:08 PM, Will Bunker w...@thebunkers.com wrote:

 Realize that I totally misunderstood the @inheritance properties.  I
 was assuming that all subclasses would be store in super class, but
 realize that it is the opposite.  So there is no actual meta data
 being generated for the user table, but all the fields are put in the
 metadata for subclass.

 On Jan 27, 3:40 pm, Will Bunker w...@thebunkers.com wrote:
  I was wrong with my initial analysis.  I had assumed because a
  subclass was persisting that the super class would also.  When I try
  and add a User I get the meta/data missing also in local environment.
 
  I have narrowed it down to one line which triggers the problem:
 
  @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
  public class User implements PersistHooks {
 
  when I take out the @Inheritance then it finds the meta-data for the
  user class.  Is this a feature or a bug??

 --
 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.comgoogle-appengine-java%2bunsubscr...@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
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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: Question: best practice to persist medium-large data?

2010-01-27 Thread Jeff Schnitzer
On Wed, Jan 27, 2010 at 3:28 PM, datanucleus andy_jeffer...@yahoo.com wrote:

 I only represent JDO, as a spec, not how GAE/J have implemented it.
 The docs for that are provided in the JDO spec and on the DataNucleus
 website. I fail to see anything controversial in how they are
 represented in those places. I've already made my feelings well enough
 known on exposing environment specific classes into user space

This response (which I have seen repeated many times on this list) is
deeply unsatisfying.  JDO is wonderful, the problem is just the
implementation!  Sounds a bit like socialism.  It certainly does no
good for the original poster.

I think there's a problem with JDO in general - it tries to be a
universal data access API, but really only gets 85% of the way there.
BigTable is something different, and the old mapping annotations are
(yet again) insufficient, so you need extensions like gae.unindexed
and twisting the query language to support batch queries.  Every time
something different comes up, JDO annotations expand and now it's full
of what feels like cruft.  Half of DataNucleus' features don't apply
to BigTable, and several significant aspects of BigTable aren't
handled by JDO.

I reposit my earlier question, how can you configure - in JDO - the
three different one-to-many representations that BigTable supports,
all of which have differing performance and transactional
characteristics:

 1) A one-to-many relationship stored as a Photo key array in the Album entity
 2) A one-to-many relationship stored as an Album key in the Photo's key parent
 3) A one-to-many relationship stored as an Album key property in a Photo entity

It won't be on the DataNucleus website because these are specifically
BigTable representation issues.  It's not in the GAE/J docs.  My guess
is that at least one of these three representations requires Key
manipulation by the user.

 And you forgot @GeneratedValue to get the equivalent thing, so not
 really any different. So you have shorter names, but then you have an
 IDE too that adds them with completion, so what difference is that?

Length is irrelevant.  Being able to be read and understood easily
without digging through piles of documentation on three different
websites is essential.  In this respect, JDO is awful.

 Either way, if you think you can make some improvements and really
 want to effect a standard then the Apache JDO group is waiting to hear
 from you

My goal is to create a simple interface that allows users to
conveniently access the power of BigTable with the shortest possible
learning curve.

Your goal is to create a grand unified API which allows nearly any
entity graph to be represented on nearly any concrete datastore.

Our goals are not compatible.

Jeff

-- 
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] SocialWok.com presentation qusetion on workaround on join

2010-01-27 Thread Ikai L (Google)
On Tue, Jan 26, 2010 at 5:41 PM, asianCoolz second.co...@gmail.com wrote:

 DatastoreService dataSvc =...;

 Query query = new Query(MessageRecipients)
   .addFilter(recipients), FilterOperator.EQUAL,userid)
   .addSort(date, SortDirection.DESCENDING)
   .setKeysOnly();  // -- Only fetch keys!

 //*** from the presentation , mentioned the above can only be done
 using low level api, arent jdo/jpa can get the key only value as well
 //***http://gae-java-persistence.blogspot.com/2009/10/keys-only-
 queries.html


Can you post the link to the video as well as a summary of the technique
they are discussing? I've been meaning to watch the video, but it'd be
beneficial to other developers on this list who don't have the time to watch
the whole thing.


 ListEntity msgRecpts = dataSvc.prepare(query).asList();
 ListKey parents = new ArrayListKey();
 for(Entity recep : msgREcpts) {
  parents.add(recep.getParent());
 }

 //Bulk fetch parents using key list
 MapKey, Entity msg = dataSvc.get(parents);

 //***for second part above, what is the different from doing directly
 select in statement in jpa/jdo ?
 //***http://gae-java-persistence.blogspot.com/2009/12/queries-with-and-
 in-filters.html


One of the benefits of passing a List is type safety. The example in the
link above uses a List of Strings, but you could just as easily define Java
enums with valid values. A more subtle advantage is that were you to use a
StringBuilder with an IN clause, you would be programmatically building a
String, not a List of query parameters. There's no difference at the lower
levels - both techniques get translated to multiple queries, as Max
describes.

-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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] java ip to location library

2010-01-27 Thread Andrei
Is there a library i can use on GAE that will tell me country and
probably state based on ip?
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.



Re: [appengine-java] Re: One-to-many querying for a child instance

2010-01-27 Thread Rusty Wright

Yes, as you can surmise, I'm guessing.

What's this annotation on the name property for?

@Extension(vendorName=datanucleus, key=gae.pk-name, value=true)


Sydney wrote:

Since I declared the parameter with query.declareParameters(String
nameParam);, the colon is not valid. As expected I got an exception
org.datanucleus.store.query.QueryCompilerSyntaxException: Explicit
parameters defined for query, yet implicit parameter syntax
(:nameParam) found

On Jan 27, 4:39 pm, Rusty Wright rwright.li...@gmail.com wrote:

Do you need a colon in front of nameParam?

query.setFilter(name == :nameParam);



Sydneywrote:

The query returns no result.
ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment
());
ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(.))
{
});
A a = new A(A);
B b = new B(B);
a.getBs().add(b);
PersistenceManagerFactory pmf =
JDOHelper.getPersistenceManagerFactory(transactions-optional);
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
pm.makePersistent(a);
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
}
System.out.println(a.getKey());
A ap = pm.getObjectById(A.class, A);
System.out.println(ap.getKey());
Query query = pm.newQuery(B.class);
query.setFilter(name == nameParam);
query.declareParameters(String nameParam);
ListB rs = (ListB) query.execute(B);
System.out.println(rs.size());
On Jan 23, 12:20 am, John Patterson jdpatter...@gmail.com wrote:
Execute a query on the name property of B rather than loading it by  
key.  If the name is unique the result should only contain one B.

On 23 Jan 2010, at 11:41,Sydneywrote:

I have a one to many relationship. There is a problem in the way I
query for a B object. I was wondering what is the best way (most
efficient) to do that.
A a = new A(A);
B b = new B(B);
a.getBs().add(b);
pm.makePersistent(a); // it's done inside a transaction
A ap = pm.getObjectById(A.class, A); // FINE
B bp = pm.getObjectById(B.class, B); // NOT FOUND Exception
I guess B is not found because the real key is not B but B + A key.
How do you get the B object when you don't know nothing about A?
public class A {
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   @Extension(vendorName = datanucleus, key = gae.encoded-pk,
value = true)
   private String key;
   @Persistent
   @Extension(vendorName = datanucleus, key = gae.pk-name, value
= true)
   private String name;
   @Persistent(mappedBy = a)
   private ListB bs;
   public A(String name) {
   this.name = name;
   bs = new ArrayListB();
   }
... Getter/Setter
}
@PersistenceCapable(identityType =
javax.jdo.annotations.IdentityType.APPLICATION)
public class B {
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   @Extension(vendorName = datanucleus, key = gae.encoded-pk,
value = true)
   private String key;
   @Persistent
   @Extension(vendorName = datanucleus, key = gae.pk-name, value
= true)
   private String name;
   @Persistent
   private A a;
   public B(String name) {
   this.name = name;
   }
... Getter/Setter
}
--
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 
athttp://groups.google.com/group/google-appengine-java?hl=en
.




--
0x2B | ~0x2b  --  Hamlet

--
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: vs-accounting.appspot.com - datastore viewer error

2010-01-27 Thread aswath satrasala
Local file:
datastore-indexes

!-- Used 2 times in query history --
datastore-index kind=Tenant ancestor=true source=auto
property name=tenants_INTEGER_IDX direction=asc/
/datastore-index

!-- Used 1 time in query history --
datastore-index kind=Party ancestor=true source=auto
property name=partys_INTEGER_IDX direction=asc/
/datastore-index

!-- Used 1 time in query history --
datastore-index kind=SecurityGroup ancestor=true source=auto
property name=secGrpList_INTEGER_IDX direction=asc/
/datastore-index

datastore-index kind=PartyRole ancestor=true source=auto
property name=partyRoles_INTEGER_IDX direction=asc/
/datastore-index

/datastore-indexes


Production:
Party   partys_INTEGER_IDX ▲
Includes ancestors
  *Serving*
PartyRole   partyRoles_INTEGER_IDX ▲
Includes ancestors
  *Serving*
SecurityGroup   secGrpList_INTEGER_IDX ▲
Includes ancestors
  *Serving*
Tenant   tenants_INTEGER_IDX ▲
Includes ancestors

12hrs ago , the secGrpList_INTEGER_IDX  was not shown on the production
admin console.  Now, it is showing up.

The datastore viewer is still responding back error page.

-Aswath


On Thu, Jan 28, 2010 at 2:48 AM, Ikai L (Google) ika...@google.com wrote:

 What does you local indexes file look like? Can you post the indexes listed
 in your production admin console?

 On Tue, Jan 26, 2010 at 11:24 PM, aswath satrasala 
 aswath.satras...@gmail.com wrote:

 Hello GAE team,
 Further observations made while testing the app.  I am not able to write
 entities to the datastore.  Upon examining the logs, I found the following
 error.

 com.veersoft.action.CreateTenantAction doCreate: 
 com.google.appengine.api.datastore.DatastoreNeedIndexException:

 no matching index found..
 datastore-index kind=SecurityGroup ancestor=true source=manual
 property name=secGrpList_INTEGER_IDX direction=asc/


 /datastore-index

 The application is fine on the local develpment server.

 -Aswath


 On Tue, Jan 26, 2010 at 8:51 PM, aswath satrasala 
 aswath.satras...@gmail.com wrote:

 Hello,
 My app-id is vs-accounting.

 I login into appengine.google.com. I choose the above application.  Then
 I click on the datastore viewer.
 I get the error

  Server Error

 A server error has occurred.

 Return to Applications screen » https://appengine.google.com/

 -Aswath


  --
 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.comgoogle-appengine-java%2bunsubscr...@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
 http://googleappengine.blogspot.com | http://twitter.com/app_engine

 --
 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.comgoogle-appengine-java%2bunsubscr...@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: Question: best practice to persist medium-large data?

2010-01-27 Thread datanucleus
Jeff,

I simply reply to your rant about JDO annotations. Nowhere do I say
JDO is the solution for all tasks. My goal is not as you state either,
but instead to provide persistence via *any* standardised API to all
available datastores, and to correct misconceptions about those APIs
(whether JDO or JPA), whether caused by misleading GAE/J docs, or by
other peoples attitudes. All of the types of things that GAE/J
BigTable requires (unindexed etc) are perfectly doable with the
available JDO (or to a lesser extent) JPA APIs and metadata (whether
annotations or XML) - so the specs are adequate to handle this. How
GAE/J have implemented it on top of that only they can comment on, but
I'm sure when they have time they'll implement all required patterns.

I'll leave you to your goal :-)

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