[appengine-java] Discussion on will-it-play-in-app-engine
BlazeDS messaging does not work on GAE. -- 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] JDO bug - won't persist parent class attributes - has it been fixed?
I remember there was a bug denoted somewhere in the documentation (http://code.google.com/appengine/docs/java/datastore ) that JDO won't persist properties/attributes of the parent classes. Has this been fixed in the latest release? -- Corneliu --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] Merge join + Key Name used to emulate sort field
Hello! I recently discovered the power of merge joins on app-engine (no more composite indexes required! hurray!). I am also aware that i cannot inequality filters, neither order clauses. But what if i generate the primary key of the entities using the values of the field i wish to order by. This way, since entities are ordered (by default) by key ascending, it means they will effectively be ordered by my criteria. I also realized that this would work only for entities with no parents. Otherwise the parent part of the key will mess things up (it is compared first and this will determine the real order! which is not what i need/want); solution - no parents ;) Quote from compareTo() method of Key: The relationship between individual Key Keys is performed by comparing app followed by kind followed by id. If both keys are assigned names rather than ids, compares names instead of ids. If neither key has an id or a name we return an arbitrary but consistent result. Assuming all other components are equal, all ids are less than all names. More specifically: if both keys are assigned names rather than ids, compares names instead of ids. Are names compared lexically? It seems so, but i want to be sure. Can you tell me? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] JDO vs low level API
Hello! I would like to bring in discussion a comparison between JDO and the low level API. Google recommends using the low-level API only to framework developers, but JDO seems to inflexible to me. I've been using JDO for a month now and i've come across some nasty limitations. I will mention a few here: The datastore itself is very flexible: you can have an entity called SimpleObject with property1name and propery2name and another SimpleObject with property1name and propery3name! A low level API query for entities of kind SimpleObject will fetch both. In JDO, i simply cannot define two objects with the same name SimpleObject and different properties, so i cannot take advantage of this feature that the datastore offers! JDO offers Owned One-to-Many Relationships by defining a List of objects that will be persisted as the children of the current object; also one can manipulate these objects by calls to List methods. But what if i want to say list.get(50.000) ? How is this implemented? Will it try to bring all 50.000 entities in memory (and fail?!), or will it bring only the 50.000th one? In the latter case, how does it count to 50.000, because the low level API doesn't offer support for limit 1 offset 49.999 (it's above the 1000 limit) Or let's say i need to get the child from that list, that satisfies a certain condition: get the 5th child that has propertyX='y' ; in pseudo-code something like this: list.get('propertyx', OP_EQUALS, 'y', 5). There is no such thing obviously; i should use a query instead: select * from SimpleObjectChild where propertyX = 'y' and ancestor is _simpleobjectkey_ which is fine. My question is: since i need to use queries for more complicated issues, why bother with the list declaration :), if i will never use the plain old list.get(i). You might suggest iterating through the list: for (SimpleObjectChild soc: List) { if (soc.properyX.equals(y) { do_something(); } } But isn't this prohibitively inefficient?? If i have a list of 100.000 elements, of which only about 100 have propertyX='y', i could fetch them (very fast) via the query: select * from SimpleObjectChild where propertyX = 'y' and ancestor is _simpleobjectkey_, then operate on them. Regarding JDO Extent, it's also very inefficient (in my opinion)! See following example: doit() { for (DbContact db : extent) { if (db.getVersion().equals(0.0)) { do_stuff(); db.setVersion(0.2); } } } If i have a list of 100.000 elements, and have already handled 75.000 of them on previous calls (there is the 30 second limit to a call, not enough time to handle all entities in a call); then, on a successive call, the extent will also pass through version 2.0 entities, wasting time, and maybe even never reaching a version 1.0 entity within the 30 seconds allowed. Instead i took the following approach: (AdvancedQuery is a simple wrapper made by me, over JDO Query) I am using a query, that always fetches the first 50 (could be any number) unhandled objects so far. It is written in JDO, but can just as easily be written in the low level API. doit() { AdvancedQuery aq = new AdvancedQuery(pm.newQuery (DbRawContact.class)); aq.addFilter(version, ==, 0.1); if (!firstRun) { aq.addFilter(encodedKey, , lastKey); } aq.appendOrdering(encodedKey ascending); aq.setLimit(50); List DbRawContact results = (ListDbRawContact) aq.execute(); for (DbRawContact db : results) { do_stuff(); db.setVersion(0.2); lastkey = db.key; } return lastkey; } I am seriously thinking of developing my own framework based on the low-level API to take advantage of it's full power and flexibility. I know what the pros are (power and flexibility), i'm asking are there any cons? :) (besides, perhaps, longer developing time and effort on my behalf) Corneliu --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] JDO vs low level API
Hello! I would like to bring in discussion a comparison between JDO and the low level API. Google recommends using the low-level API only to framework developers, but JDO seems to inflexible to me. I've been using JDO for a month now and i've come across some nasty limitations. I will mention a few here: The datastore itself is very flexible: you can have an entity called SimpleObject with property1name and propery2name and another SimpleObject with property1name and propery3name! A low level API query for entities of kind SimpleObject will fetch both. In JDO, i simply cannot define two objects with the same name SimpleObject and different properties, so i cannot take advantage of this feature that the datastore offers! JDO offers Owned One-to-Many Relationships by defining a List of objects that will be persisted as the children of the current object; also one can manipulate these objects by calls to List methods. But what if i want to say list.get(50.000) ? How is this implemented? Will it try to bring all 50.000 entities in memory (and fail?!), or will it bring only the 50.000th one? In the latter case, how does it count to 50.000, because the low level API doesn't offer support for limit 1 offset 49.999 (it's above the 1000 limit) Or let's say i need to get the child from that list, that satisfies a certain condition: get the 5th child that has propertyX='y' ; in pseudo-code something like this: list.get('propertyx', OP_EQUALS, 'y', 5). There is no such thing obviously; i should use a query instead: select * from SimpleObjectChild where propertyX = 'y' and ancestor is _simpleobjectkey_ which is fine. My question is: since i need to use queries for more complicated issues, why bother with the list declaration :), if i will never use the plain old list.get(i). You might suggest iterating through the list: for (SimpleObjectChild soc: List) { if (soc.properyX.equals(y) { do_something(); } } But isn't this prohibitively inefficient?? If i have a list of 100.000 elements, of which only about 100 have propertyX='y', i could fetch them (very fast) via the query: select * from SimpleObjectChild where propertyX = 'y' and ancestor is _simpleobjectkey_, then operate on them. Regarding JDO Extent, it's also very inefficient (in my opinion)! See following example: doit() { for (DbContact db : extent) { if (db.getVersion().equals(0.0)) { do_stuff(); db.setVersion(0.2); } } } If i have a list of 100.000 elements, and have already handled 75.000 of them on previous calls (there is the 30 second limit to a call, not enough time to handle all entities in a call); then, on a successive call, the extent will also pass through version 2.0 entities, wasting time, and maybe even never reaching a version 1.0 entity within the 30 seconds allowed. Instead i took the following approach: (AdvancedQuery is a simple wrapper made by me, over JDO Query) I am using a query, that always fetches the first 50 (could be any number) unhandled objects so far. It is written in JDO, but can just as easily be written in the low level API. doit() { AdvancedQuery aq = new AdvancedQuery(pm.newQuery (DbRawContact.class)); aq.addFilter(version, ==, 0.1); if (!firstRun) { aq.addFilter(encodedKey, , lastKey); } aq.appendOrdering(encodedKey ascending); aq.setLimit(50); List DbRawContact results = (ListDbRawContact) aq.execute (); for (DbRawContact db : results) { do_stuff(); db.setVersion(0.2); lastkey = db.key; } return lastkey; } I am seriously thinking of developing my own framework based on the low-level API to take advantage of it's full power and flexibility. I know what the pros are (power and flexibility), i'm asking are there any cons? :) (besides, perhaps, longer developing time and effort on my behalf) Corneliu --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] App-engine + Google Calendar
Hello! I am trying to build an application in which a customer should be able to put a reminder on a note, that he added to an entity within the application (e.g. remind me to call this guy/company on Monday at 9:15 or note to myself: log in again at 16:00 to see it there have been any changes in this article). That way the customer will be notified (by e-mail, for example) at the precise moment. I could use a cron job that periodically (every 5 minutes let's say) searches though Reminder enitities in the datastore and sends e- mails accordingly. But it would be nicer if could integrate Google Calendar with app- engine, thus not re-inventing the wheel. The problem i stumbled across while doing this is the fact that i need the persons password to write a new event in his calendar. Is there a way that he can grant permission to the application to modify his calendar for this purpose? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] App-engine + Google Docs
Hello again! I was thinking of implementing a feature in my application to export portions of my application's database into a customer's google-docs spreadsheet, so that he can make modifications on it, download it, print it, etc. Also i am interested in the reverse operation: the possibility to import a spreadsheet into the datastore. The problem that I'm facing is that i don't have access to a user's documents without his password. Isn't there a way for me to programatically request access to a document (or to create a document on his behalf) and for him to interactively grant me these rights (preferably only once, and then remember the rights until he intentionally decides to revoke them) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] JDO BUG !?
Hello! I have some objects in the database that have a String property called version. Some of them have version = '0.2', the others have '0.0' I have an application written in java. When i query for an object with version 0.2 with the low level api it works (it finds 62 obejcts) DatastoreService ds = DatastoreServiceFactory.getDatastoreService (); Query q1 = new Query(DbRawContact); q1.addFilter(version, FilterOperator.EQUAL, 0.2); PreparedQuery pq = ds.prepare(q1); log.info(remainging: + pq.countEntities()); When i query with JDO the query doesn't fetch anything! I won't post the JDO query here, because i actually use a wrapper around it (too many lines to post here); but i'm 99.99% sure that code is correct because it works for a version = '0.0' query with no problems! (and for all other queries that i'm doing with it) I even tried to fetch one of those version 0.2 objects using a different property; was succesful, so then i tried a consecutive query with version = fetchedObject.getVersion(). No results! What gives? :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] How to make a query using low level API using the 'key' property?
Hello, How can i make a Query using the lowlevel API, similar to this: select * from Entity where key certain_key ? In JDO i would do something like this: select * from Entity where encodedKey a_key_string where encodedKey is my objects' primary key: @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @Extension(vendorName=datanucleus, key=gae.encoded-pk, value=true) private String encodedKey; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] How to make a isKeysOnly() query in JDO?
Hello! I've read that a keys only query is much faster than a normal query, so I want to use this for pagination. But the setKeysOnly() is only applicable to com.google.appengine.api.datastore.Query, not also javax.jdo.Query. I've been using JDO so far, so is there a way to tell JDO you're asking only for keys? I'm trying to do pagination, so at a given moment i will have to skip through entitites, beyond the well known 1000 limit. So i was thinking of making conscutive (key only!) queries of (max) 1000 entities, with the filter: key key of last element fetched by the previous query. When i reach the the entities i need to display i will call pm.getObjectsById() on the last set of keys. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] Inconsistence between how app-engine sorts string encoded-keys and java method String.compareTo()
Hello! I ran over this problem. I was retrieving a DbContact data set simply ordered by encodedKey ascending, and i got this list: [(key agljb3NpbnV4NjhyIQsSCkRiQ3VzdG9tZXIYm0gMCxIJRGJDb250YWN0GJxIDA name EUROTRIM) , (key agljb3NpbnV4NjhyIQsSCkRiQ3VzdG9tZXIYnUgMCxIJRGJDb250YWN0GJ5IDA name ANCA ELECTRIC SYSTEMS) , (key agljb3NpbnV4NjhyIQsSCkRiQ3VzdG9tZXIYn0gMCxIJRGJDb250YWN0GKBIDA name TWIN TRADING) ... So, apparently agljb3NpbnV4NjhyIQsSCkRiQ3VzdG9tZXIYnUgMCxIJRGJDb250YWN0GJ5IDA agljb3NpbnV4NjhyIQsSCkRiQ3VzdG9tZXIYn0gMCxIJRGJDb250YWN0GKBIDA (the second and the third entries in the above list) But agljb3NpbnV4NjhyIQsSCkRiQ3VzdG9tZXIYnUgMCxIJRGJDb250YWN0GJ5IDA.compareTo (agljb3NpbnV4NjhyIQsSCkRiQ3VzdG9tZXIYn0gMCxIJRGJDb250YWN0GKBIDA) = 37 0, which is opposite! The encodedKey field is defined in the DbContact class as: @PersistenceCapable(identityType = IdentityType.APPLICATION) public class DbContact extends DbEntity { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @Extension(vendorName=datanucleus, key=gae.encoded-pk, value=true) private String encodedKey; @Persistent private DbCustomer customer; ... Also, i have a DbCustomer class which is the parent of a DbContact class, defined as: @PersistenceCapable(identityType = IdentityType.APPLICATION) public class DbCustomer extends DbEntity { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @Extension(vendorName=datanucleus, key=gae.encoded- pk,value=true) private String encodedKey; @Persistent(mappedBy = customer) @Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=customerProfile desc)) private ListDbContact contacts; .. So what's with this inconsistence? Have any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] Unicode to ASCII equivalence (java.text.Normalizer not supported by app-engine VM)
Hello! I need to save unicode strings and also create a ascii version of them (to make a keyword list for searching purposes) such as: Animale, cu excepţia peştelui = [ANIMALE, EXCEPTIA, PESTELUI] For that i need the following conversions: ţ - t, ş - s and so on. My first approach was the following: orig = Normalizer.normalize(field, Form.NFKD).toCharArray(); ascii = new byte[orig.length]; count = 0; for (int i = 0; i orig.length; i++) { if (orig[i] 128) { ascii[count++] = (byte) orig[i]; } } try { field = new String(ascii, UTF-8); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } This works very well in java generally, but when i tried it in an app- engine project i got a compiler error: java.text.Normalizer.Form is not supported by Google App Engine's Java runtime environment What workaround do you suggest? Thank you, Cornel --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---