[appengine-java] Latency/Aggressive Recycling/Timings
I have moved my app previously described at http://www.rexcel.ca:/gems/bbb/load.home to http://gems-bbb.appspot.com/gems/bbb/load.home Since it is designed to be very responsive I felt I need to understand the spin out/spin in issue and see what immediate band-aid solutions may be available. I did not want to get into running CRON jobs to ping my App because they work against what the google folks are designing. Definitions: The server has 3 modes of running. (1) COLD - after a deploy when the cache is purposefully trashed. Everything is loaded from datastore for the first request (2) WARM - servlet is initialized to service request, classes need to be refreshed but cache can be used to service request (no datastore I/ O) (3) HOT - instance is ready and no datastore I/O is needed to service request. First, despite all the claims that an app should stay in for many minutes my App seems to get SPUN OUT AFTER A MINUTE OR 2. But I can live with that. Here is why, with my timings. My system measures turn around times in 2 places. One, inside the servlet. The second on the HTTP page sending the request. The HTTP page gives the total time. The servlet gives the time from when the request is received to when it leaves. The difference between the 2 is the network time. For a warm start (where the JVM has to be built etc) the increase in network time can be attributed to this extra startup process. Here are the average times that I have discovered. The datastore times are obtained by looking at the logs. All times are in secs. The Network time from my site in Canada consistently averages about . 410 secs. COLD start. Server=7.500 JVM and Datastore 6.500 Total 14.410 WARM Start: Server 1.100 (Mainly cache read) JVM etc=2.800 Total 4.310 HOT Start: Server .001 Total .411 My next optimization will be to warm up the Datastore as a scheduled task just before I finish the WARM request so that the next request that comes in will also have a Warm datastore. My log seems to show that Datanucleus needs between .200 and .500 secs to handle the initialization for each class. As a peer review of these findings you can go to the app at http://gems-bbb.appspot.com/gems/bbb/load.home Clicking on the top-left GEM will send a refresh with a timestamp. When it returns, hovering over the top left GEM will give the timings. When the server time has an * prefix it also includes the initialization time because a warm or cold start has happened. The ggogle folks can also look at the logs. I am interested to know how come I get spun out after only a minute or 2. Steve Pritchard -- 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: Eclipse hangs at startup, Ubuntu
I believe this is a problem not in Eclipse but in Gtk ... On Mar 4, 4:15 am, Steven Jay Cohen wrote: > I can confirm this same behavior on my GWT projects not AppEngine. > > It's sporadic and can be addressed exactly as described in this post. > > I am using Eclipse 3.5.2 64bit, Mac OSX 10.6.2, GPE, Subversive, and > PDT plugins. > > Steven > --www.stevenjaycohen.com > > On Mar 2, 11:17 am, Rajeev Dayal wrote: > > > That message corresponds to GPE's attempt to update your project's > > war/WEB-INF/lib folder on project classpath initialization, which occurs on > > Eclipse startup. > > > Sometimes, problems can occur if there is some sort of lock being held on > > the files in that directory (such as by a version control plugin). Do you > > have any version control plugins installed in Eclipse? > > > We've actually made some changes so that the update of war/WEB-INF/lib > > occurs on classpath change instead of classpath init. That should alleviate > > this sporadic issue. The fix will be available in a forthcoming version of > > GPE.On Mon, Mar 1, 2010 at 2:34 AM, Jeff Schnitzer > > wrote: > > > Did anyone ever resolve this in a consistent way? > > > > I recently upgraded from OSX 10.5 to 10.6, and now my Eclipse (Cocoa > > > 64-bit, as I was using before) hangs on most startups. I see the > > > "Updating MyProje... - 1.3.1" in the bottom right corner and the > > > entire window is locked up. Only way out is to Force Quit. > > > > It doesn't happen on every startup. I can often get it working after > > > a few tries. > > > > This was a brand-new OS install on a new HD. I did, however, copy my > > > eclipse directory over by hand, and the workspace was imported as part > > > of my user data. > > > > Jeff > > > > On Jan 14, 12:49 am, pgoetz wrote: > > > > Hi group, > > > > > I have a problem with the Google Eclipse Plugin. I am developing an > > > > application for the Google App Engine (Eclipse JEE Galileo, Google > > > > Plugin 1.2.0, Google App Engine SDK 1.3.0, OS Ubuntu 9.10). Yesterday > > > > I reinstalled the Google Plugin and Google App Engine SDK after I got > > > > the same problem with an older version of the SDK. > > > > Today I started Eclipse and after the workspace comes up, I see the > > > > message "Updating /...ne - 1.3.0" in the status bar of > > > > Eclipse. I suspect that it means "Updating /Google App > > > > Engine - 1.3.0". With this message my whole Eclipse freezes and I can > > > > only kill the process. > > > > Does anybody know why that happens? And how can I prevent the plugin > > > > from performing the update? > > > > I had the same problem yesterday with the old setup and the solution > > > > was to remove the folders for the plugin from Eclipse "plugins" and > > > > "features" directories and to reinstall the plugin. Then it worked > > > > yesterday and crashed this morning. > > > > > Thank you very much for your help! > > > > > Greetings, > > > > > Peter > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Google App Engine for Java" group. > > > To post to this group, send email to > > > google-appengine-j...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > google-appengine-java+unsubscr...@googlegroups.com > > unsubscr...@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/google-appengine-java?hl=en. -- 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] Querying datastore with keylist?
Hi, there is an example in this page: http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html look for the "contains()" thanks Karel On Sun, Mar 7, 2010 at 2:19 AM, Alexander Lagler wrote: > hi, > > can you tell me how to query datastore in java with an KEYLIST by > using > List mylist = (List)query.execute(LIST OF KEYS); > > i do not want to use > pm.getObjectsById(List) > because i want to use both 'setOrdering()' and 'setRange()' > > couldnt find something on the web, so any information and/or > codeexample would be great! > > thx in advance > alex > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Simple query
Hi guy, I hate to bother everybody again. I have a ver simple class, some fields, and an String primary key. One of the fields "lastTimeIndexed" is a date. I am trying to get the max value for it, the folowing method working fine upto 3k records, but now I added more, and it takes minutes to run. I have the autoGenerate flag set to true in the datastore-indexes.xml, and also the datastore-indexes-auto.xml file... here is the code, what is wrong with it?? can anybody think of a better way of doing this?? public Date getLastDate() { Date lastDate = null; PersistenceManager pm = getPersistenceManager(); Query query = pm.newQuery(IndexEntry.class); query.setOrdering("lastTimeIndexed desc"); query.setRange(0, 1); query.setUnique(true); try { IndexEntry entries = (IndexEntry) query.execute(); if (entries != null) { lastDate = entries.getLastTimeIndexed(); } } finally { query.closeAll(); } return lastDate; } thanks Karel -- 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] searchable datastore
you can try to use compass for searching. and a simple demo here: http://hapeblog.appspot.com/blog.shtml?id=7002 On Sun, Mar 7, 2010 at 2:13 PM, Gal Dolber wrote: > I am using a "List tags" property on my searchable models, I fill > it when I put the entities with all the matches I will like to have, and I > query them like query.filter("tags", "SomeString"); > > Regards > > 2010/3/6 Prashant Gupta > > Hi, >> >> I want to make my app's data searchable. is there any library or tool >> available which can make my task easier? >> >> 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. >> > > -- > 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. > -- dream or truth -- 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: Updating a simple boolean
It doesn't show up in the log. It is on DEBUG level. On Mar 7, 4:12 pm, datanucleus wrote: > Plenty shows up in the log when you set it to DEBUG level. -- 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: Hard Deadline Exceeded and High CPU
Actually my app is written in Groovy on Grails. It is supposed to be supported by App Engine and seems to work OK, with a few warts and this problem. Unfortunately it means I probably don't have as much control over application start up times as I might with another framework. Is there any way to increase the amount of time my app is allowed to spend spinning up? If not, then app engine really doesn't support Groovy on Grails. We should probably note this stuff somewhere. On Mar 7, 6:08 pm, John Patterson wrote: > The Jetty server is not used again after an error so another one has > to be spun-up for you next request. The only thing you can do about > it is tackle the HDEEs which is not always easy. It sounds like they > might be due to long start-up time? > > If so there are a number of tactics you can use to reduce this: > > Use lazy initialization as much as possible. > Split your app into a user facing version and an admin version that > share the same datastore > If you use Guice try using the non-AOP version that does not enhance > classes at startup > Spring - not sure but others mentioned turning off classpath scanning > Try reducing external jar dependencies - not sure how much affect > loading these has > > If the cause of the HDEEs is that your requests take a long time then > you'll need to reduce processing time > > Try using the Deferred class: > > http://groups.google.com/group/google-appengine-java/browse_thread/th... > > On 8 Mar 2010, at 05:37, Ken wrote: > > > > > I am getting HardDeadlineExceededErrors. What do you mean that the > > instance will be disposed? What can I do about it? > > > Thank you. > > > On Mar 7, 5:18 pm, John Patterson wrote: > >> If there are errors like HardDeadlineExceededError then the server > >> instance will be disposed. Could this be the problem? > > >> On 8 Mar 2010, at 05:09, Ken wrote: > > >>> I was just looking in the logs after making numerous requests to my > >>> application. Something is seriously wrong. I'm even having high > >>> CPU > >>> on static files. In one request it took 45 seconds of CPU to return > >>> the favicon.ico file. I guess this is really related to starting a > >>> server instance, but if that's true then the server is going down > >>> after only a few seconds of use. It is starting the server > >>> handling a > >>> request and a few seconds later dropping the server. It isn't even > >>> staying up a minute. > > >>> On Mar 7, 3:13 pm, Ken wrote: > I have a very simple Groovy on Grails application installed that > uses > only a single table. The application is really just the scaffolded > edits on this table with very few modifications to make it work. > So > it doesn't really do anything. > > About one in five clicks result in an error. The exception is a > Hard > Deadline Exceeded and there is a warning about the CPU limit as > well. > Randomly a request will take around 30 seconds of CPU for no > reason. > There is no change in the code. There is no change to the data. > The > exact same request will return with essentially no latency and then > it > will take 30 seconds of CPU. > > I thought this might be some kind of weirdness with Grails, but > there > are several issues listed that seem to be related to same issue: > > http://code.google.com/p/googleappengine/issues/detail?id=2621http:// > ... > ?id=2840http://code.google.com/p/googleappengine/issues/detail?id=2691http:// > ... > ?id=2837http://code.google.com/p/googleappengine/issues/detail?id=2846 > > I've stared them all because they all are likely related to the > same > problem I'm having. > > I was hoping that someone here knew what was going on and might be > able to help me resolve it. In one of the messages above someone > mentions moving an application to another "shard" to solve the > problem. What does this mean? Is it really a potential solution? > > Thank you. > > >>> -- > >>> You received this message because you are subscribed to the Google > >>> Groups "Google App Engine for Java" group. > >>> To post to this group, send email to > >>> google-appengine-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-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 >
[appengine-java] 2688 ms to retrive 201 entities from datastore?
Hi there, i have an entity group thish tree is like this: Room --> Table --> Game in an operation i need to retrive the whole tree, which are 201 entities and take me 2688 ms and that is a lot of time! That is common in app engine, or i am doing something wrong? Thanks in advance NM -- 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] Failing to properly detach children in owned one-to-many relationship
I am trying to load the full object graph for User, which contains a collection of decks, which then contains a collection of cards, as such: User: @PersistenceCapable(detachable = "true") @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) @FetchGroup(name = "decks", members = { @Persistent(name = "_Decks") }) public abstract class User { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) protected Key _ID; @Persistent protected String _UniqueIdentifier; @Persistent(mappedBy = "_Owner") @Element(dependent = "true") protected Set _Decks; protected User() { } } Each Deck has a collection of Cards, as such: @PersistenceCapable(detachable = "true") @FetchGroup(name = "cards", members = { @Persistent(name = "_Cards") }) public class Deck { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key _ID; @Persistent String _Name; @Persistent(mappedBy = "_Parent") @Element(dependent = "true") private Set _Cards = new HashSet(); @Persistent private Set _Tags = new HashSet(); @Persistent private User _Owner; } And finally, each card: @PersistenceCapable public class Card { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key _ID; @Persistent private Text _Question; @Persistent private Text _Answer; @Persistent private Deck _Parent; } I am trying to retrieve and then detach the entire object graph. I can see in the debugger that it loads fine, but then when I get to detaching, I can't make anything beyond the User object load. (No Decks, no Cards). At first I tried without a transaction to simply "touch" all the fields on the attached object before detaching, but that didn't help. Then I tried adding everything to the default fetch group, but that just generated warnings about GAE not supporting joins. I tried setting the fetch plan's max fetch depth to -1, but that didn't do it. Finally, I tried using FetchGroups as you can see above, and then retrieving with the following code: PersistenceManager pm = _pmf.getPersistenceManager(); pm.setDetachAllOnCommit(true); pm.getFetchPlan().setGroup("decks"); pm.getFetchPlan().setGroup("cards"); Transaction tx = pm.currentTransaction(); Query query = null; try { tx.begin(); query = pm.newQuery(GoogleAccountsUser.class); //Subclass of User query.setFilter("_UniqueIdentifier == TheUser"); query.declareParameters("String TheUser"); List results = (List)query.execute(ID); //ID = Supplied parameter //TODO: Test for more than one result and throw if(results.size() == 0) { tx.commit(); return null; } else { User usr = (User)results.get(0); //usr = pm.detachCopy(usr); tx.commit(); return usr; } } finally { query.closeAll(); if (tx.isActive()) { tx.rollback(); } pm.close(); } This also doesn't work, and I'm running out of ideas. I'm new to GAE/ JDO, so go easy please. =) Thanks, Mike -- 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: How do you transfer a List from server to client?
Great, thanks for the link Jeff. This may be what I've been looking for ages On Mar 6, 1:21 pm, Jeff Schnitzer wrote: > If you use the Google data classes (Key, GeoPt, Email, Link, User, > etc) in your entities you will have trouble serializing them through > GWT-RPC. Even though you're using JDO, you can still use Objectify's > GWT integration to solve the problem: > > http://code.google.com/p/objectify-appengine/wiki/ObjectifyWithGWT > > Jeff > > On Fri, Mar 5, 2010 at 4:04 PM, novarse wrote: > > Thanks Maly for your reply, > > I got it going. I'm using GWT and after reading the doco properly and > > adding a > > > > to my gwt.xml file and copying my jdo objects to that dir it all > > works. Real simple in the end > > > On Mar 3, 11:36 pm, Chummar Maly wrote: > >> All you need to do is put this code in a servlet and then call the servlet > >> as the button's action. Having said that is always good to learn the > >> basics. > >> Here is a link for app engine JDO implementation > >> :http://code.google.com/appengine/docs/java/gettingstarted/usingdatast > >> The easiest way to learn JDO is to use the sample app. called guestbook > >> and > >> see how it works. > >> Best of luck. > > >> Malyhttp://servetube.appspot.com > > >> On Wed, Mar 3, 2010 at 2:04 AM, Stephen Wills > >> wrote: > > >> > Hello, > >> > I have been wanting to know how to do this for a while now, but don't > >> > know > >> > where to find information on how to do this. I simply want to know how to > >> > setup my project so I can have a JDO object in the "server" package (so I > >> > can use classes like com.google.appengine.api.datastore.Key and > >> > javax.jdo.listener.StoreCallback), and request a list of those objects > >> > from > >> > my client side code. Currently I store my JDO object in my "client" > >> > package. > >> > So when a user clicks a button to retrieve all the People objects I can > >> > get > >> > back a List. I'm sure these are some fundamentally basic steps I > >> > just don't know to acheive. Do you need a persistent object on the server > >> > side and a transfer object on the client? If so how do you send the data > >> > to > >> > the transfer object. Thanks > > >> > currently have: (and want it instead in com.myapp.server but also to > >> > retrieve say List ) > >> > in com.myapp.client > > >> > import javax.jdo.annotations.IdGeneratorStrategy; > >> > import javax.jdo.annotations.IdentityType; > >> > import javax.jdo.annotations.PersistenceCapable; > >> > import javax.jdo.annotations.Persistent; > >> > import javax.jdo.annotations.PrimaryKey; > > >> > import com.google.gwt.user.client.rpc.IsSerializable; > > >> > @PersistenceCapable(identityType = IdentityType.APPLICATION) > >> > public class People implements IsSerializable { > > >> > @PrimaryKey > >> > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > >> > private Long pKeyRiderID; > > >> > @Persistent > >> > private String lastName; > >> > ... > > >> > currently in com.myapp.server: > >> > private List get() { > >> > PersistenceManager pm = PMF.get().getPersistenceManager(); > > >> > List result = null; > >> > try { > >> > String q = "select from " + People.class.getName(); > >> > result = new ArrayList((List) > >> > pm.newQuery(q).execute()); > >> > } finally { > >> > pm.close(); > >> > } > >> > return result; > >> > } > > >> > -- > >> > 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. > > >> -- > >> Chummar Malyhttp://www.tricolormusic.com > > > -- > > 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 > > 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] Re: Hard Deadline Exceeded and High CPU
The Jetty server is not used again after an error so another one has to be spun-up for you next request. The only thing you can do about it is tackle the HDEEs which is not always easy. It sounds like they might be due to long start-up time? If so there are a number of tactics you can use to reduce this: Use lazy initialization as much as possible. Split your app into a user facing version and an admin version that share the same datastore If you use Guice try using the non-AOP version that does not enhance classes at startup Spring - not sure but others mentioned turning off classpath scanning Try reducing external jar dependencies - not sure how much affect loading these has If the cause of the HDEEs is that your requests take a long time then you'll need to reduce processing time Try using the Deferred class: http://groups.google.com/group/google-appengine-java/browse_thread/thread/6f736624cc820d5b/58435cb034416166 On 8 Mar 2010, at 05:37, Ken wrote: I am getting HardDeadlineExceededErrors. What do you mean that the instance will be disposed? What can I do about it? Thank you. On Mar 7, 5:18 pm, John Patterson wrote: If there are errors like HardDeadlineExceededError then the server instance will be disposed. Could this be the problem? On 8 Mar 2010, at 05:09, Ken wrote: I was just looking in the logs after making numerous requests to my application. Something is seriously wrong. I'm even having high CPU on static files. In one request it took 45 seconds of CPU to return the favicon.ico file. I guess this is really related to starting a server instance, but if that's true then the server is going down after only a few seconds of use. It is starting the server handling a request and a few seconds later dropping the server. It isn't even staying up a minute. On Mar 7, 3:13 pm, Ken wrote: I have a very simple Groovy on Grails application installed that uses only a single table. The application is really just the scaffolded edits on this table with very few modifications to make it work. So it doesn't really do anything. About one in five clicks result in an error. The exception is a Hard Deadline Exceeded and there is a warning about the CPU limit as well. Randomly a request will take around 30 seconds of CPU for no reason. There is no change in the code. There is no change to the data. The exact same request will return with essentially no latency and then it will take 30 seconds of CPU. I thought this might be some kind of weirdness with Grails, but there are several issues listed that seem to be related to same issue: http://code.google.com/p/googleappengine/issues/detail?id=2621http:// ... ?id=2840http://code.google.com/p/googleappengine/issues/detail?id=2691http:// ... ?id=2837http://code.google.com/p/googleappengine/issues/detail?id=2846 I've stared them all because they all are likely related to the same problem I'm having. I was hoping that someone here knew what was going on and might be able to help me resolve it. In one of the messages above someone mentions moving an application to another "shard" to solve the problem. What does this mean? Is it really a potential solution? Thank you. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-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-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-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] Cannot get my basic Struts2 application to work
Hi All, I am having trouble getting my basic struts2 application to working with GAE/J. I read the discussion about OGNL permission but I feel I am not hitting that point yet. Here is the URL. http://demoappbasic.appspot.com/HelloWorld.action And this is the error I see, Error: result 'null' not found Here is my struts.xml http://struts.apache.org/dtds/struts-2.0.dtd";> /jsp/HelloWorld.jsp /jsp/Time.jsp Thanks, Deepam Tiwan -- 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] searchable datastore
I am using a "List tags" property on my searchable models, I fill it when I put the entities with all the matches I will like to have, and I query them like query.filter("tags", "SomeString"); Regards 2010/3/6 Prashant Gupta > Hi, > > I want to make my app's data searchable. is there any library or tool > available which can make my task easier? > > 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. > -- 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] Querying datastore with keylist?
hi, can you tell me how to query datastore in java with an KEYLIST by using List mylist = (List)query.execute(LIST OF KEYS); i do not want to use pm.getObjectsById(List) because i want to use both 'setOrdering()' and 'setRange()' couldnt find something on the web, so any information and/or codeexample would be great! thx in advance alex -- 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: What are the rules for object persistence between requests
On Sun, Mar 7, 2010 at 2:30 PM, tempy wrote: > Well I didn't think that GAE would start up a new JVM per request, but > I assumed the GC would clean up any data created between requests, as > there seems to be nothing left holding references to said data. One > of these days I will read up on the details of java garbage > collection... This is fundamental Java behavior - static fields are not garbage collected unless the class itself is unloaded. 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.
[appengine-java] Re: Hard Deadline Exceeded and High CPU
I am getting HardDeadlineExceededErrors. What do you mean that the instance will be disposed? What can I do about it? Thank you. On Mar 7, 5:18 pm, John Patterson wrote: > If there are errors like HardDeadlineExceededError then the server > instance will be disposed. Could this be the problem? > > On 8 Mar 2010, at 05:09, Ken wrote: > > > > > I was just looking in the logs after making numerous requests to my > > application. Something is seriously wrong. I'm even having high CPU > > on static files. In one request it took 45 seconds of CPU to return > > the favicon.ico file. I guess this is really related to starting a > > server instance, but if that's true then the server is going down > > after only a few seconds of use. It is starting the server handling a > > request and a few seconds later dropping the server. It isn't even > > staying up a minute. > > > On Mar 7, 3:13 pm, Ken wrote: > >> I have a very simple Groovy on Grails application installed that uses > >> only a single table. The application is really just the scaffolded > >> edits on this table with very few modifications to make it work. So > >> it doesn't really do anything. > > >> About one in five clicks result in an error. The exception is a Hard > >> Deadline Exceeded and there is a warning about the CPU limit as well. > >> Randomly a request will take around 30 seconds of CPU for no reason. > >> There is no change in the code. There is no change to the data. The > >> exact same request will return with essentially no latency and then > >> it > >> will take 30 seconds of CPU. > > >> I thought this might be some kind of weirdness with Grails, but there > >> are several issues listed that seem to be related to same issue: > > >>http://code.google.com/p/googleappengine/issues/detail?id=2621http://... > >> ?id=2840http://code.google.com/p/googleappengine/issues/detail?id=2691http://... > >> ?id=2837http://code.google.com/p/googleappengine/issues/detail?id=2846 > > >> I've stared them all because they all are likely related to the same > >> problem I'm having. > > >> I was hoping that someone here knew what was going on and might be > >> able to help me resolve it. In one of the messages above someone > >> mentions moving an application to another "shard" to solve the > >> problem. What does this mean? Is it really a potential solution? > > >> Thank you. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Google App Engine for Java" group. > > To post to this group, send email to google-appengine-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: What are the rules for object persistence between requests
Well I didn't think that GAE would start up a new JVM per request, but I assumed the GC would clean up any data created between requests, as there seems to be nothing left holding references to said data. One of these days I will read up on the details of java garbage collection... On Mar 7, 9:01 pm, Jeff Schnitzer wrote: > On Sun, Mar 7, 2010 at 11:36 AM, tempy wrote: > > Interesting... now I need to go and make sure all my logic still works > > if singletons stick around between requests. GAE is full of > > surprises! Thanks for the tip =) > > It may be true that GAE is full of surprises, but this shouldn't have > been one of them :-) > > Your GAE instance is a (modified) copy of Jetty that starts up, serves > requests for a while, and maybe gets shut down if you don't have any > more traffic. You can't possibly think that GAE would start up a JVM > and Jetty for every single request! > > 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] Re: Hard Deadline Exceeded and High CPU
If there are errors like HardDeadlineExceededError then the server instance will be disposed. Could this be the problem? On 8 Mar 2010, at 05:09, Ken wrote: I was just looking in the logs after making numerous requests to my application. Something is seriously wrong. I'm even having high CPU on static files. In one request it took 45 seconds of CPU to return the favicon.ico file. I guess this is really related to starting a server instance, but if that's true then the server is going down after only a few seconds of use. It is starting the server handling a request and a few seconds later dropping the server. It isn't even staying up a minute. On Mar 7, 3:13 pm, Ken wrote: I have a very simple Groovy on Grails application installed that uses only a single table. The application is really just the scaffolded edits on this table with very few modifications to make it work. So it doesn't really do anything. About one in five clicks result in an error. The exception is a Hard Deadline Exceeded and there is a warning about the CPU limit as well. Randomly a request will take around 30 seconds of CPU for no reason. There is no change in the code. There is no change to the data. The exact same request will return with essentially no latency and then it will take 30 seconds of CPU. I thought this might be some kind of weirdness with Grails, but there are several issues listed that seem to be related to same issue: http://code.google.com/p/googleappengine/issues/detail?id=2621http://code.google.com/p/googleappengine/issues/detail ?id=2840http://code.google.com/p/googleappengine/issues/detail?id=2691http://code.google.com/p/googleappengine/issues/detail ?id=2837http://code.google.com/p/googleappengine/issues/detail?id=2846 I've stared them all because they all are likely related to the same problem I'm having. I was hoping that someone here knew what was going on and might be able to help me resolve it. In one of the messages above someone mentions moving an application to another "shard" to solve the problem. What does this mean? Is it really a potential solution? Thank you. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-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-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: Hard Deadline Exceeded and High CPU
I was just looking in the logs after making numerous requests to my application. Something is seriously wrong. I'm even having high CPU on static files. In one request it took 45 seconds of CPU to return the favicon.ico file. I guess this is really related to starting a server instance, but if that's true then the server is going down after only a few seconds of use. It is starting the server handling a request and a few seconds later dropping the server. It isn't even staying up a minute. On Mar 7, 3:13 pm, Ken wrote: > I have a very simple Groovy on Grails application installed that uses > only a single table. The application is really just the scaffolded > edits on this table with very few modifications to make it work. So > it doesn't really do anything. > > About one in five clicks result in an error. The exception is a Hard > Deadline Exceeded and there is a warning about the CPU limit as well. > Randomly a request will take around 30 seconds of CPU for no reason. > There is no change in the code. There is no change to the data. The > exact same request will return with essentially no latency and then it > will take 30 seconds of CPU. > > I thought this might be some kind of weirdness with Grails, but there > are several issues listed that seem to be related to same issue: > > http://code.google.com/p/googleappengine/issues/detail?id=2621http://code.google.com/p/googleappengine/issues/detail?id=2840http://code.google.com/p/googleappengine/issues/detail?id=2691http://code.google.com/p/googleappengine/issues/detail?id=2837http://code.google.com/p/googleappengine/issues/detail?id=2846 > > I've stared them all because they all are likely related to the same > problem I'm having. > > I was hoping that someone here knew what was going on and might be > able to help me resolve it. In one of the messages above someone > mentions moving an application to another "shard" to solve the > problem. What does this mean? Is it really a potential solution? > > Thank you. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: JDO Level2 Cache setup for dummies
Hello, Currently I made a memcache layer over my DAO to prevent calling the datastore if it is not neccessary. Do I understand right, that this L2 cache is doing exactly the same? If I e.g. fire a request and then fire the same query again (and in the mean time no update or delete was done) it would take it from the cache instead of doing the datastore call? Or is this someting else? Why is it not disabled by default (are there draw backs)? Thanks, Toby On Mar 6, 12:39 pm, datanucleus wrote: > > Is it possible that DN L2 caching in GAE drives down CPU milliseconds > > used but overall response times get slower? > > Benefits of an L2 cache are subject to what you're doing (it's benefit > is for multiple PM's for a PMF accessing the same objects, and hence > providing a "quick" way of accessing them). Obviously the log tells > you timings of everything related to it. -- 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: Updating a simple boolean
Plenty shows up in the log when you set it to DEBUG level. -- 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: "Policy prevented put operation" during stress testing
On closer inspection of my logs, it appears that I might be hitting my per-minute limits for read/write to the datastore, and possibly memcache. Although I'm nowhere near the limit of 4800 calls/minute to the image manipulation API, I might well be hitting the 5 megabyte per minute limit for that service. Apologies for my misunderstanding. If this is the case, what's the recommended way to deal with this? Should I make repeated requests to the quota-ed service (perhaps with an exponential backoff) until I get success? This will increase the latency of my application, but I would prefer this to seeing requests fail. Thanks, Jon On Mar 5, 11:04 pm, Jon Blower wrote: > I haven't done anywhere near 14,000 image transforms in the entire > lifetime of the application (only 491 today for instance) so I don't > think this is the reason I'm getting the OverQuotaException for image > transforms. > > I haven't noticed my Quota page showing "limited" for any quantity, > but haven't monitored this too closely. > > I don't quite understand the way you've expressed the limits for > memcache - do you mean there's a write limit of 56 megabytes per > minute (and a read limit of 284 megabytes per minute)? If so, I'm > pretty sure I'm nowhere near these limits either. At the time of the > errors occurring I am reading and writing to/from memcache at a rate > of no more than 2MB/minute. > > However, my application does nothing at all for hours or days, then I > perform tests every once in a while. So these rates, whilst not high > in absolute terms, are unusual for my application. Could this be > relevant? > > Thanks, Jon > > On 5 Mar, 21:57, "Ikai L (Google)" wrote: > > > Is there any chance you're hitting per minute quotas? > > >http://code.google.com/appengine/docs/quotas.html > > > Image transforms have this quota, for instance: > > > 14,000 transforms/minute > > > Memcache has a limit of 56/mb of writes and 284/mb of reads. > > > On Fri, Mar 5, 2010 at 1:49 PM, Jon Blower wrote: > > > Hi Ikai, > > > > I'm afraid I don't have any unit test code easily available, but I > > > could make a code sample when I have a little more time. In the > > > meantime I have some more information. It's not just the memcache put > > > operation that fails in this way. I've also seen similar failures of > > > other API operations like datastore get: > > > > com.google.apphosting.api.ApiProxy$OverQuotaException: The API > > > call datastore_v3.Get() required more quota than is available > > > > and calling image transform operations (to convert PNG to JPEG): > > > > com.google.apphosting.api.ApiProxy$OverQuotaException: The API > > > call images.Transform() required more quota than is available > > > > In all cases I'm well within my daily quota for my app. During stress > > > testing (using JMeter and ramping up the client threads) I see a > > > consistent pattern of thirty or so successes, followed by thirty or so > > > failures (of memcache put, datastore get or image transform). Then I > > > see successes again, then failures and so on. > > > > My interpretation of these data is as follows: > > > 1) Stress test starts, all is well, all requests succeed for a while > > > 2) GAE monitors the number of API calls the application makes in a 10- > > > second sliding window. (I'm guessing here.) > > > 3) After a while GAE detects that the app is calling the various APIs > > > at a rate above a certain limit. So requests start failing. > > > 4) The failed requests take longer to process than successful ones. > > > So when failures start happening, the rate of calling the APIs goes > > > down. > > > 5) At some point the 10-second average (or whatever) dips below the > > > limit, so we get successes again. > > > 6) And so on... with successful requests the API calling rate goes up > > > above the limit and requests start failing. > > > > These are complete guesses, but would seem to fit the pattern I > > > observe. Is there likely to be any truth in this? > > > > Thanks, > > > Jon > > > > On 5 Mar, 19:40, "Ikai L (Google)" wrote: > > >> Jon, do you happen to have unit test code that reproduces this that I > > >> can plug in to an app? I'd like to reproduce this. > > > >> On Thu, Mar 4, 2010 at 1:31 PM, Jon Blower wrote: > > >> > Hi, > > > >> > I have a GAE-J application that involves requesting dynamically- > > >> > generated images. The application has fairly high latency (~1s per > > >> > request). I'm stress-testing the application using JMeter, hitting > > >> > GAE with four simultaneous threads, each looping through a fixed set > > >> > of requests. I get a consistent pattern, in which the first twenty or > > >> > thirty requests succeed, then every subsequent request fails. The > > >> > server log shows that the failures occur during a memcache put > > >> > operation: > > > >> > "com.google.appengine.api.memcache.stdimpl.GCacheException: Policy > > >> > prevented put operation > > >> > at > > >> > com.
[appengine-java] Interpretation of 503 (Service not available) errors
Hi, I'm stress testing a simple GAE-Java application that serves static images: nothing is generated dynamically. The test client has multiple threads (up to 100) that request randomly-selected images. As the number of threads in the client gets to 50 and above I can achieve hundreds of requests per second - but many of the requests fail with 503 (service not available) errors. The errors come in blocks: a whole bunch of requests will fail with 503, then I'll get a lot of successes, then another batch of failures. Is this likely to be because I'm hitting the 500 requests per second limit (http://code.google.com/appengine/docs/quotas.html#Requests)? If so is there any way to change this behaviour so that, as the limit is approached, clients see higher latency rather than errors? Also, I've noticed that if I run the test client on a different machine I don't see the errors. Could GAE be blocking my original test client, having noticed a large number of requests from the same IP address? Does GAE have this sort of per-client filter? Thanks for any help, Jon -- 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: Enable billing to avoid HardDeadlineExceededError?
This is happening to me in a Groovy on Grails application, but it doesn't seem to be a loading problem. Even if I'm clicking through the application I get these kinds of problems randomly. Probably one out of every five clicks fails if I wait for it to. Grails uses Spring underneath so maybe this is the same issue. On Mar 4, 10:49 am, Wong wrote: > Now I get this 500 error quite frequently. See the log below in Admin > Console. I believe this is different from HardDeadlineExceededError > problem (exceeded 30 seconds limit) as there wasn't any > HardDeadlineExceededError exception logged in log. The site was > accessed by one user, hence the simultaneous dynamic request limit (30 > requests) shouldn't have exceeded. Any idea? -- 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] Hard Deadline Exceeded and High CPU
I have a very simple Groovy on Grails application installed that uses only a single table. The application is really just the scaffolded edits on this table with very few modifications to make it work. So it doesn't really do anything. About one in five clicks result in an error. The exception is a Hard Deadline Exceeded and there is a warning about the CPU limit as well. Randomly a request will take around 30 seconds of CPU for no reason. There is no change in the code. There is no change to the data. The exact same request will return with essentially no latency and then it will take 30 seconds of CPU. I thought this might be some kind of weirdness with Grails, but there are several issues listed that seem to be related to same issue: http://code.google.com/p/googleappengine/issues/detail?id=2621 http://code.google.com/p/googleappengine/issues/detail?id=2840 http://code.google.com/p/googleappengine/issues/detail?id=2691 http://code.google.com/p/googleappengine/issues/detail?id=2837 http://code.google.com/p/googleappengine/issues/detail?id=2846 I've stared them all because they all are likely related to the same problem I'm having. I was hoping that someone here knew what was going on and might be able to help me resolve it. In one of the messages above someone mentions moving an application to another "shard" to solve the problem. What does this mean? Is it really a potential solution? Thank you. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: What are the rules for object persistence between requests
On Sun, Mar 7, 2010 at 11:36 AM, tempy wrote: > Interesting... now I need to go and make sure all my logic still works > if singletons stick around between requests. GAE is full of > surprises! Thanks for the tip =) It may be true that GAE is full of surprises, but this shouldn't have been one of them :-) Your GAE instance is a (modified) copy of Jetty that starts up, serves requests for a while, and maybe gets shut down if you don't have any more traffic. You can't possibly think that GAE would start up a JVM and Jetty for every single request! 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.
[appengine-java] Re: What are the rules for object persistence between requests
Interesting... now I need to go and make sure all my logic still works if singletons stick around between requests. GAE is full of surprises! Thanks for the tip =) On Mar 7, 7:22 pm, John Patterson wrote: > Hi Mike, static variables are a useful way to cache short term data. > They will last as long as the instance lasts which is hard to > predict. I read some time ago that there is an undocumented limit of > about 100MB of memory per instance. > > On 8 Mar 2010, at 01:02, tempy wrote: > > > > > On the dev server, I have a singleton DAO that encapsulates all logic > > relating to the datastore and memcache. I was surprised to find that > > the singleton persists between requests, and will generally go on > > existing until I restart the dev environment. Does this reflect > > production app engine behavior? If so, is there any documentation for > > when/how objects in app engine persist and/or are destroyed between > > requests? > > > Thanks, > > Mike > > > -- > > 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: Updating a simple boolean
Actually, nothing for this shows up up in the log. I get "Mail sent to: address ...". Anyway, I am not a fan of JDO/JPA/etc, at any level. Also, you make it sound as if I am wasting your time. You could have chosen not to answer, although I appreciate the fact that you did. People come to this forum because they don't know everything. On Mar 7, 3:30 am, datanucleus wrote: > Observance of the JDO spec would tell you that calling makePersistent > on something that is already managed is a pointless call since JDO > knows you updated the field (the whole point of enhancing those > classes); but you don't seem to bother doing a pm.close(). Obviously > the log would reveal what exactly is happening -- 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] What are the rules for object persistence between requests
Hi Mike, static variables are a useful way to cache short term data. They will last as long as the instance lasts which is hard to predict. I read some time ago that there is an undocumented limit of about 100MB of memory per instance. On 8 Mar 2010, at 01:02, tempy wrote: On the dev server, I have a singleton DAO that encapsulates all logic relating to the datastore and memcache. I was surprised to find that the singleton persists between requests, and will generally go on existing until I restart the dev environment. Does this reflect production app engine behavior? If so, is there any documentation for when/how objects in app engine persist and/or are destroyed between requests? Thanks, Mike -- 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-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] What are the rules for object persistence between requests
On the dev server, I have a singleton DAO that encapsulates all logic relating to the datastore and memcache. I was surprised to find that the singleton persists between requests, and will generally go on existing until I restart the dev environment. Does this reflect production app engine behavior? If so, is there any documentation for when/how objects in app engine persist and/or are destroyed between requests? Thanks, Mike -- 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 save 2 or more sub entities
Hi, I've created a testservlet to illustrate my problem. I want an owned uni-directional relationship between an entity and a list of sub entities. The model enties are detachable because the client shall be a GWT app. When I add one sub entity it works as expected. When I add the second only the second entity is stored in the datastore and the first is lost. When I add the third sub-entity I get an exception. Here is the testservlet and then I'll add the result of the three cases. What can be wrong? Gunnar package com.google.appengine.demo; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; import java.util.List; import javax.jdo.PersistenceManager; import javax.jdo.Query; import javax.jdo.Transaction; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @SuppressWarnings("serial") public class ListordertestServlet extends HttpServlet { StringBuilder sb = new StringBuilder(); public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { sb = new StringBuilder(); resp.setContentType("text/plain"); deleteAll(); MyEntity entity = persist(); add(entity, "one"); query(); add(entity, "two"); query(); // add(entity, "three"); // query(); resp.getWriter().println(sb.toString()); } private MyEntity persist() { MyEntity entity = new MyEntity(); MyEntity detached = null; ArrayList subEntities = new ArrayList(); entity.setMyList(subEntities); PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.makePersistent(entity); tx.commit(); detached = pm.detachCopy(entity); sb.append("persisted entity: " + entity.getId() + "\n"); sb.append("detached object: " + detached + "\n"); } catch (Exception e) { printStackTrace(e); } finally { if (tx.isActive()) tx.rollback(); pm.close(); } return detached; } private MyEntity add(MyEntity entity, String name) { MyEntity detached = null; sb.append("before add " + entity.toString() + "\n"); PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); final SubEntity subEntity = new SubEntity(name); entity.getMyList().add(subEntity); pm.makePersistent(entity); tx.commit(); detached = pm.detachCopy(entity); sb.append("added sub-entity " + name + "\n"); sb.append("detached object: " + detached + "\n"); } catch (Exception e) { printStackTrace(e); } finally { if (tx.isActive()) tx.rollback(); pm.close(); } return detached; } private void deleteAll() { PersistenceManager pm = PMF.get().getPersistenceManager(); Query query = pm.newQuery(MyEntity.class); Transaction tx = pm.currentTransaction(); try { tx.begin(); List results = (List) query.execute(); if (results.iterator().hasNext()) { pm.deletePersistentAll(results); } tx.commit(); sb.append("deleted all objects" + "\n"); } catch (Exception e) { printStackTrace(e); } finally { if (tx.isActive()) tx.rollback(); query.closeAll(); pm.close(); } } private void query() { sb.append("query\n"); PersistenceManager pm = PMF.get().getPersistenceManager(); Query query = pm.newQuery(MyEntity.class); try { List results = (List) query.execute(); if (results.iterator().hasNext()) { for (MyEntity e : results)
[appengine-java] Re: Children in an owned one-to-many relationship not being retrieved, what am I doing wrong?
Solved the issue finally... Turned out that I was forgetting to set the deck's key's parent property to "user" properly, and thus the deck/ card combination was forming one entity group and the user was another group. I still don't get why this had the odd effect of loading user object with an in-tact deck collection but then making the deck's cards unreachable, even upon being "touched", but either way I've fixed my problem. Thanks for the help! On Mar 7, 3:45 pm, tempy wrote: > Same thing, but... > > I tried wrapping both the initial makepersistent() call and then the > query in transactions, without changing anything else: > > I get this, which I hope is related to my original issue: > > javax.jdo.JDOFatalUserException: Illegal argument > NestedThrowables: > java.lang.IllegalArgumentException: can't operate on multiple entity > groups in a single transaction. found both Element { > type: "GoogleAccountsUser " //This is the specific subclass of User > id: 11} > > and Element { > type: "Deck" > name: "_8ad07638-b233-4fef-9a7f-1cfbad4eaab3" > > } > > Now why would it think that decks and users are in different entity > groups... > > On Mar 7, 3:05 pm, Toby wrote: > > > > > Okay, I see. In my case it is a List not a Set ... but I think that > > really makes no difference. > > What I think is strange is that you initialize the fields: > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Parent") > > @Element(dependent = "true") > > private Set _Cards = new HashSet(); > > > maybe that causes the _Cards to be reinitialized when the Entity is > > deserialized. Can you try to remove that? > > > Cheers, > > Toby > > > On Mar 7, 2:19 pm, tempy wrote: > > > > Thanks for the suggestion... > > > > I did try that exact code and sad to say it didn't help, just returned > > > a 0-size collection. I'm still trying to figure this out... > > > > On Mar 7, 10:58 am, Toby wrote: > > > > > Hello Mike, > > > > > have you tried touching them before you close the query? > > > > I had similar problem and only solved it by calling the getter for the > > > > owned collection before detaching the results. > > > > > if (results.iterator().hasNext()) { > > > > for (Product fp : results) { > > > > //this is to force the collections to be > > > > detached > > > > fp.getItems(); > > > > } > > > > return pm.detachCopyAll(results); > > > > ... > > > > > I found no better way to do that. I actually started managing > > > > relationships by hand now because you have more control and more > > > > performance especially if you do not always need the child > > > > collections. > > > > > But maybe there is also a way to trigger that through an annotation. > > > > > Cheers, > > > > Toby > > > > > On Mar 7, 1:46 am, tempy wrote: > > > > > > I have the following 3-part owned relationship... > > > > > > Users, the root entity, have a collection of Decks, as such (I am not > > > > > including the specific subclass of User as it doesn't seem to be > > > > > relevant): > > > > > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > > > > > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) > > > > > public abstract class User { > > > > > @PrimaryKey > > > > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > > > > protected Key _ID; > > > > > > @Persistent > > > > > protected String _UniqueIdentifier; > > > > > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Owner") > > > > > @Element(dependent = "true") > > > > > protected Set _Decks; > > > > > > protected KleioUser() > > > > > { > > > > > } > > > > > > } > > > > > > Each Deck has a collection of Cards, as such: > > > > > @PersistenceCapable > > > > > public class Deck { > > > > > @PrimaryKey > > > > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > > > > private Key _ID; > > > > > > @Persistent > > > > > String _Name; > > > > > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Parent") > > > > > @Element(dependent = "true") > > > > > private Set _Cards = new HashSet(); > > > > > > @Persistent > > > > > private Set _Tags = new HashSet(); > > > > > > @Persistent > > > > > private KleioUser _Owner; > > > > > > } > > > > > > And finally, each card: > > > > > > @PersistenceCapable > > > > > public class Card { > > > > > @PrimaryKey > > > > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > > > > private Key _ID; > > > > > > �...@persistent > > > > > private Text _Question; > > > > > @Persistent > > > > > private Text _Answer; > > > > > @Persistent > > > > > private Deck _Parent; > > > > > > } > > > > > > I've only run this on the dev server. When I create a new user and > > > > > populate the corresponding decks and corresponding cards and then call >
[appengine-java] Re: Children in an owned one-to-many relationship not being retrieved, what am I doing wrong?
Same thing, but... I tried wrapping both the initial makepersistent() call and then the query in transactions, without changing anything else: I get this, which I hope is related to my original issue: javax.jdo.JDOFatalUserException: Illegal argument NestedThrowables: java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction. found both Element { type: "GoogleAccountsUser " //This is the specific subclass of User id: 11 } and Element { type: "Deck" name: "_8ad07638-b233-4fef-9a7f-1cfbad4eaab3" } Now why would it think that decks and users are in different entity groups... On Mar 7, 3:05 pm, Toby wrote: > Okay, I see. In my case it is a List not a Set ... but I think that > really makes no difference. > What I think is strange is that you initialize the fields: > @Persistent(defaultFetchGroup = "true", mappedBy = "_Parent") > @Element(dependent = "true") > private Set _Cards = new HashSet(); > > maybe that causes the _Cards to be reinitialized when the Entity is > deserialized. Can you try to remove that? > > Cheers, > Toby > > On Mar 7, 2:19 pm, tempy wrote: > > > > > Thanks for the suggestion... > > > I did try that exact code and sad to say it didn't help, just returned > > a 0-size collection. I'm still trying to figure this out... > > > On Mar 7, 10:58 am, Toby wrote: > > > > Hello Mike, > > > > have you tried touching them before you close the query? > > > I had similar problem and only solved it by calling the getter for the > > > owned collection before detaching the results. > > > > if (results.iterator().hasNext()) { > > > for (Product fp : results) { > > > //this is to force the collections to be detached > > > fp.getItems(); > > > } > > > return pm.detachCopyAll(results); > > > ... > > > > I found no better way to do that. I actually started managing > > > relationships by hand now because you have more control and more > > > performance especially if you do not always need the child > > > collections. > > > > But maybe there is also a way to trigger that through an annotation. > > > > Cheers, > > > Toby > > > > On Mar 7, 1:46 am, tempy wrote: > > > > > I have the following 3-part owned relationship... > > > > > Users, the root entity, have a collection of Decks, as such (I am not > > > > including the specific subclass of User as it doesn't seem to be > > > > relevant): > > > > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > > > > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) > > > > public abstract class User { > > > > @PrimaryKey > > > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > > > protected Key _ID; > > > > > @Persistent > > > > protected String _UniqueIdentifier; > > > > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Owner") > > > > @Element(dependent = "true") > > > > protected Set _Decks; > > > > > protected KleioUser() > > > > { > > > > } > > > > > } > > > > > Each Deck has a collection of Cards, as such: > > > > @PersistenceCapable > > > > public class Deck { > > > > @PrimaryKey > > > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > > > private Key _ID; > > > > > @Persistent > > > > String _Name; > > > > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Parent") > > > > @Element(dependent = "true") > > > > private Set _Cards = new HashSet(); > > > > > @Persistent > > > > private Set _Tags = new HashSet(); > > > > > @Persistent > > > > private KleioUser _Owner; > > > > > } > > > > > And finally, each card: > > > > > @PersistenceCapable > > > > public class Card { > > > > @PrimaryKey > > > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > > > private Key _ID; > > > > > �...@persistent > > > > private Text _Question; > > > > @Persistent > > > > private Text _Answer; > > > > @Persistent > > > > private Deck _Parent; > > > > > } > > > > > I've only run this on the dev server. When I create a new user and > > > > populate the corresponding decks and corresponding cards and then call > > > > pm.makepersistent(user), everything looks fine and I can see all the > > > > user, deck, and card entities in the development datastore. However, > > > > when I try to retrieve a user with the following query: > > > > > Query query = _pm.newQuery(SpecificUser.class); > > > > query.setFilter("_UniqueIdentifier == TheUser"); > > > > query.declareParameters("String TheUser"); > > > > > try { > > > > List results = > > > > (List)query.execute(ID); > > > > > if(results.size() == 0) > > > > return null; > > > > else > > > >
[appengine-java] Re: Children in an owned one-to-many relationship not being retrieved, what am I doing wrong?
Okay, I see. In my case it is a List not a Set ... but I think that really makes no difference. What I think is strange is that you initialize the fields: @Persistent(defaultFetchGroup = "true", mappedBy = "_Parent") @Element(dependent = "true") private Set _Cards = new HashSet(); maybe that causes the _Cards to be reinitialized when the Entity is deserialized. Can you try to remove that? Cheers, Toby On Mar 7, 2:19 pm, tempy wrote: > Thanks for the suggestion... > > I did try that exact code and sad to say it didn't help, just returned > a 0-size collection. I'm still trying to figure this out... > > On Mar 7, 10:58 am, Toby wrote: > > > Hello Mike, > > > have you tried touching them before you close the query? > > I had similar problem and only solved it by calling the getter for the > > owned collection before detaching the results. > > > if (results.iterator().hasNext()) { > > for (Product fp : results) { > > //this is to force the collections to be detached > > fp.getItems(); > > } > > return pm.detachCopyAll(results); > > ... > > > I found no better way to do that. I actually started managing > > relationships by hand now because you have more control and more > > performance especially if you do not always need the child > > collections. > > > But maybe there is also a way to trigger that through an annotation. > > > Cheers, > > Toby > > > On Mar 7, 1:46 am, tempy wrote: > > > > I have the following 3-part owned relationship... > > > > Users, the root entity, have a collection of Decks, as such (I am not > > > including the specific subclass of User as it doesn't seem to be > > > relevant): > > > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > > > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) > > > public abstract class User { > > > @PrimaryKey > > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > > protected Key _ID; > > > > @Persistent > > > protected String _UniqueIdentifier; > > > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Owner") > > > @Element(dependent = "true") > > > protected Set _Decks; > > > > protected KleioUser() > > > { > > > } > > > > } > > > > Each Deck has a collection of Cards, as such: > > > @PersistenceCapable > > > public class Deck { > > > @PrimaryKey > > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > > private Key _ID; > > > > @Persistent > > > String _Name; > > > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Parent") > > > @Element(dependent = "true") > > > private Set _Cards = new HashSet(); > > > > @Persistent > > > private Set _Tags = new HashSet(); > > > > @Persistent > > > private KleioUser _Owner; > > > > } > > > > And finally, each card: > > > > @PersistenceCapable > > > public class Card { > > > @PrimaryKey > > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > > private Key _ID; > > > > �...@persistent > > > private Text _Question; > > > @Persistent > > > private Text _Answer; > > > @Persistent > > > private Deck _Parent; > > > > } > > > > I've only run this on the dev server. When I create a new user and > > > populate the corresponding decks and corresponding cards and then call > > > pm.makepersistent(user), everything looks fine and I can see all the > > > user, deck, and card entities in the development datastore. However, > > > when I try to retrieve a user with the following query: > > > > Query query = _pm.newQuery(SpecificUser.class); > > > query.setFilter("_UniqueIdentifier == TheUser"); > > > query.declareParameters("String TheUser"); > > > > try { > > > List results = > > > (List)query.execute(ID); > > > > if(results.size() == 0) > > > return null; > > > else > > > return results.get(0); > > > > } finally { > > > query.closeAll(); > > > } > > > > I get the user just fine, and all the user's corresponding decks. But > > > the decks have no cards. "Touching" the deck's cards collection with > > > a .size() method doesn't load the cards, just returns 0, nor does > > > setting the cards to the default fetch group. I also tried to set the > > > pm's fetchplan to -1, but that didn't have the desired effect either. > > > > The weird thing is that if I persist the Deck without a parent user, > > > then I will get the deck back, along with all its cards, with no > > > problems. > > > > I've tried a lot of other things too and I'm starting to run low on > > > ideas (and high on frustration), so any help would be appreciated. > > > > Thanks, > > > Mike -- You receiv
[appengine-java] Re: Children in an owned one-to-many relationship not being retrieved, what am I doing wrong?
Thanks for the suggestion... I did try that exact code and sad to say it didn't help, just returned a 0-size collection. I'm still trying to figure this out... On Mar 7, 10:58 am, Toby wrote: > Hello Mike, > > have you tried touching them before you close the query? > I had similar problem and only solved it by calling the getter for the > owned collection before detaching the results. > > if (results.iterator().hasNext()) { > for (Product fp : results) { > //this is to force the collections to be detached > fp.getItems(); > } > return pm.detachCopyAll(results); > ... > > I found no better way to do that. I actually started managing > relationships by hand now because you have more control and more > performance especially if you do not always need the child > collections. > > But maybe there is also a way to trigger that through an annotation. > > Cheers, > Toby > > On Mar 7, 1:46 am, tempy wrote: > > > > > I have the following 3-part owned relationship... > > > Users, the root entity, have a collection of Decks, as such (I am not > > including the specific subclass of User as it doesn't seem to be > > relevant): > > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) > > public abstract class User { > > @PrimaryKey > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > protected Key _ID; > > > @Persistent > > protected String _UniqueIdentifier; > > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Owner") > > @Element(dependent = "true") > > protected Set _Decks; > > > protected KleioUser() > > { > > } > > > } > > > Each Deck has a collection of Cards, as such: > > @PersistenceCapable > > public class Deck { > > @PrimaryKey > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > private Key _ID; > > > @Persistent > > String _Name; > > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Parent") > > @Element(dependent = "true") > > private Set _Cards = new HashSet(); > > > @Persistent > > private Set _Tags = new HashSet(); > > > @Persistent > > private KleioUser _Owner; > > > } > > > And finally, each card: > > > @PersistenceCapable > > public class Card { > > @PrimaryKey > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > private Key _ID; > > > �...@persistent > > private Text _Question; > > @Persistent > > private Text _Answer; > > @Persistent > > private Deck _Parent; > > > } > > > I've only run this on the dev server. When I create a new user and > > populate the corresponding decks and corresponding cards and then call > > pm.makepersistent(user), everything looks fine and I can see all the > > user, deck, and card entities in the development datastore. However, > > when I try to retrieve a user with the following query: > > > Query query = _pm.newQuery(SpecificUser.class); > > query.setFilter("_UniqueIdentifier == TheUser"); > > query.declareParameters("String TheUser"); > > > try { > > List results = > > (List)query.execute(ID); > > > if(results.size() == 0) > > return null; > > else > > return results.get(0); > > > } finally { > > query.closeAll(); > > } > > > I get the user just fine, and all the user's corresponding decks. But > > the decks have no cards. "Touching" the deck's cards collection with > > a .size() method doesn't load the cards, just returns 0, nor does > > setting the cards to the default fetch group. I also tried to set the > > pm's fetchplan to -1, but that didn't have the desired effect either. > > > The weird thing is that if I persist the Deck without a parent user, > > then I will get the deck back, along with all its cards, with no > > problems. > > > I've tried a lot of other things too and I'm starting to run low on > > ideas (and high on frustration), so any help would be appreciated. > > > Thanks, > > Mike -- 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 Sitebricks
Has anybody been successful deploying a Sitebricks application to Google 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: Children in an owned one-to-many relationship not being retrieved, what am I doing wrong?
Hello Mike, have you tried touching them before you close the query? I had similar problem and only solved it by calling the getter for the owned collection before detaching the results. if (results.iterator().hasNext()) { for (Product fp : results) { //this is to force the collections to be detached fp.getItems(); } return pm.detachCopyAll(results); ... I found no better way to do that. I actually started managing relationships by hand now because you have more control and more performance especially if you do not always need the child collections. But maybe there is also a way to trigger that through an annotation. Cheers, Toby On Mar 7, 1:46 am, tempy wrote: > I have the following 3-part owned relationship... > > Users, the root entity, have a collection of Decks, as such (I am not > including the specific subclass of User as it doesn't seem to be > relevant): > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) > public abstract class User { > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > protected Key _ID; > > @Persistent > protected String _UniqueIdentifier; > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Owner") > @Element(dependent = "true") > protected Set _Decks; > > protected KleioUser() > { > } > > } > > Each Deck has a collection of Cards, as such: > @PersistenceCapable > public class Deck { > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Key _ID; > > @Persistent > String _Name; > > @Persistent(defaultFetchGroup = "true", mappedBy = "_Parent") > @Element(dependent = "true") > private Set _Cards = new HashSet(); > > @Persistent > private Set _Tags = new HashSet(); > > @Persistent > private KleioUser _Owner; > > } > > And finally, each card: > > @PersistenceCapable > public class Card { > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Key _ID; > > �...@persistent > private Text _Question; > @Persistent > private Text _Answer; > @Persistent > private Deck _Parent; > > } > > I've only run this on the dev server. When I create a new user and > populate the corresponding decks and corresponding cards and then call > pm.makepersistent(user), everything looks fine and I can see all the > user, deck, and card entities in the development datastore. However, > when I try to retrieve a user with the following query: > > Query query = _pm.newQuery(SpecificUser.class); > query.setFilter("_UniqueIdentifier == TheUser"); > query.declareParameters("String TheUser"); > > try { > List results = > (List)query.execute(ID); > > if(results.size() == 0) > return null; > else > return results.get(0); > > } finally { > query.closeAll(); > } > > I get the user just fine, and all the user's corresponding decks. But > the decks have no cards. "Touching" the deck's cards collection with > a .size() method doesn't load the cards, just returns 0, nor does > setting the cards to the default fetch group. I also tried to set the > pm's fetchplan to -1, but that didn't have the desired effect either. > > The weird thing is that if I persist the Deck without a parent user, > then I will get the deck back, along with all its cards, with no > problems. > > I've tried a lot of other things too and I'm starting to run low on > ideas (and high on frustration), so any help would be appreciated. > > Thanks, > Mike -- 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: Task Queue Problems
Hi, maybe it is the Method.GET? I just do like this: Queue queue = QueueFactory.getDefaultQueue(); queue.add(TaskOptions.Builder.url("/tasks/foo")); and make sure you handle post and get requests in the servlet, just in case. Cheers, Toby On Mar 6, 4:07 am, rletness wrote: > Ok so either I'm doing something really stupid or I can't get a simple > task to execute. I have defined a task worker at /tasks/foo. > > I can hit /tasks/foo no problem and the code executes fine (just a > simple servlet of course). The problem is when I add a task to the > queue like: > > queue.add(TaskOptions.Builder.url("/tasks/foo").method(Method.GET)); > > I can't seem to get the code in the task servlet to execute. If I > check the queue in admin console it shows a task executed and in the > request logs it shows that /foo/task was called and returned 200, but > the code never executed. Just to make sure I wasn't insane I modified > the task servlet to simply throw a RuntimeException so it would return > 500. When invoked manually, it returns 500 as expected, but when > invoked through the task queue, it shows /tasks/foo returning 200. > Any ideas? > > Here is the request log. The first request is the one i invoked > manually from the browser and the second is one invoked by the task > queue. It shows the first returning 500 (as expected) but the second > returns 200. > > 1. > 03-05 06:38PM 54.097 /tasks/foo 500 37ms 38cpu_ms 3kb Mozilla/ > 5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.8) Gecko/ > 20100202 Firefox/3.5.8,gzip(gfe),gzip(gfe) > > 1. > 03-05 06:37PM 54.803 /tasks/foo 200 60ms 19cpu_ms 3kb AppEngine- > Google; (+http://code.google.com/appengine) -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Updating a simple boolean
Observance of the JDO spec would tell you that calling makePersistent on something that is already managed is a pointless call since JDO knows you updated the field (the whole point of enhancing those classes); but you don't seem to bother doing a pm.close(). Obviously the log would reveal what exactly is happening -- 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.