[appengine-java] Learning JDO for AppEngine
Hello, I have found the following tutorial on the JDO which is used in AppEngine http://code.google.com/appengine/docs/java/datastore/jdo/ but would like a somewhat more in-depth step-by-step resource on JDO. I was wondering, given it was published in 2003 when JDO 2.0 was not yet out and given that AppEngine's JDO is 2.3, how relevant is the foolowing book to learning JDO? http://www.amazon.com/Java-Data-Objects-David-Jordan/dp/0596002769/ref=sr_1_12?ie=UTF8qid=1325862357sr=8-12 Is it still worth reading or is it completely out of date? I cannot find a more up-to-date comprehensive reference on JDO. Thanks, John Goche -- 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] android + AppEngine + Users API
Hello, I would like to use the Users API of App Engine from Android. Here is what I plan to do. On the Android UI I present a from where the user enters the username and password and clicks OK. From there the data is submitted to Google which allows the user to authenticate. This is exactly the part I don't know how to do because all examples on the web are for web browsers and not for mobile devices like android. I also don't have a clue of how OpenID or Google Accounts or Google mail authentication works. Basically, do I get a cookie over SSL which allows me to prove my identity? Doesn't app engine close the session once the HTTP response is received by the client. If so how can I actually stay logged in? Thanks, John Goche -- 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] lost trying to understand JDO on BigTable: please help coding example
Hello, I have the following classes in a unidirectional 1-1 relationship to each other: class A { B b; // ... more fields } class B { String k; // ... more fields } I want k to be the primary key for class B as well as for class A. How do I accomplish this task? I've been told I need to implement a PK class but don't understand why I would need one. Given I cannot find much information on the BigTable implementation I don't even know how to think about the problem (I understand RDBMS and think of each class as having its own table, although this may be wrong). Thank you for your kind help, John Goche -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] lost trying to understand JDO on BigTable: please help coding example
On Tue, Jan 24, 2012 at 10:08 PM, Matthew Jaggard matt...@jaggard.org.ukwrote: Do you have any good reason to have separate classes rather than one big one with all the stuff that's in each? Well, the reason is that I need to reuse class B. For example class A also has a separate ListB member. The main reason I ask is that loading two entities is about twice as expensive as loading one twice the size. Tough. I cannot sacrifice code readability here. If you do have a good reason, you could still persist them as a single entity, but I'm not sure how to do this in JDO. In Objectify, you would just @Embed one class into the other. Mat. Thank you for your reply. Looking forward to hearing from someone who would know how to do this in JDO. Regards, John Goche On 24 January 2012 20:05, John Goche johngoch...@googlemail.com wrote: Hello, I have the following classes in a unidirectional 1-1 relationship to each other: class A { B b; // ... more fields } class B { String k; // ... more fields } I want k to be the primary key for class B as well as for class A. How do I accomplish this task? I've been told I need to implement a PK class but don't understand why I would need one. Given I cannot find much information on the BigTable implementation I don't even know how to think about the problem (I understand RDBMS and think of each class as having its own table, although this may be wrong). Thank you for your kind help, John Goche -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] lost trying to understand JDO on BigTable: please help coding example
On Tue, Jan 24, 2012 at 10:31 PM, Ikai Lan (Google) ika...@google.comwrote: You don't need to implement a Primary Key class. Specify the primary field as a Key and generate the key using KeyFactory: http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyFactory.Builder.html Thank you for your reply, but what is a key with ancestors? You can autogenerate IDs with this method: http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyRange.html You'll probably get more mileage persisting the object in a single entity (treating the datastore more like a key-value store) and using a translation later to turn it into classes to work with than trying to do magic trying to get these classes to persist the way you want them to. Can you give me an example? In my code I have the following: class Data { static ListA la; } class A { B foo; C bar; ListD foobar1; ListE foobar2; } class B { String k; // (needs to be the primary key of A) //... } I only need persist la, but I have the given class structure and have made everything persistencecapable. Not sure if this is the way to go. In my opinion, you're not sacrificing code readability - you're just moving work around. So how would I move stuff around in the example given above? Thanks, John Goche -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] lost trying to understand JDO on BigTable: please help coding example
On Wed, Jan 25, 2012 at 1:57 AM, Jeff Schnitzer j...@infohazard.org wrote: On Tue, Jan 24, 2012 at 4:21 PM, John Goche johngoch...@googlemail.com wrote: The main reason I ask is that loading two entities is about twice as expensive as loading one twice the size. Tough. I cannot sacrifice code readability here. This is an intriguing attitude. You have arrived with a preconceived notion of exactly what you want your Java data structure to look like and you are now trying to force GAE into that mold. If you stay this path, you will very likely end up abandoning appengine in frustration. At best, you will produce software that works poorly. You have a long learning curve ahead of you, both in terms of learning how the datastore works and learning how to create a data model that is both performant and maintainable. I have two pieces of advice: * Read the Storing Data section of the GAE manual *completely*. The nature of keys and ancestry is only one of many pieces of knowledge you must master to develop applications here. Even though it looks vaguely like one on the surface, this is not an RDBMS and your learned instincts are likely wrong. Do not believe you can just understand JDO. * When you ask for help, try be somewhat more general describing what you want to do. You're asking about how to specifically arrange primary keys in Java classes when it may be the case that what you want to do is embed one class in the other. There is not one canonical way to model entities on GAE, so if you want help, start from the perspective of this is roughly what I'm trying to do... is it the right way? As to your specific problem, I think you'll get a lot more help if you rephrase the question. Everyone here is just taking guesses at what you're trying to ask. OK, I have read all the GAE documentation relating to the datastore, including the following book: http://www.amazon.com/Essential-App-Engine-High-Performance-Developers/dp/032174263X/ref=sr_1_3?ie=UTF8qid=1327483323sr=8-3 which has chapter 4 describing the datastore and chapter 10 describing the low-level API. Now my use case. I have several users accessing GAE. Each user has their own store of data which they access via logging in: @PersistenceCapable class Data { // email of logged in client @NotPersistent static String loggedInClientEmail; // currently logged in user @NotPersistent static User user; // store used during current interaction @NotPersistent static Store store; // complete list of stores @Persistent static ListStore stores; } Since each user has their own data in the datastore I could model each store as an Entity. In each session I need to read everything concerning the entity. The key characteristic of this model is that each user does not see other user's data, but each response from the server tends to includes all the data pertaining to the particular user logged in. class Store { ListUser friends; ListItem items; } class Item { long itemCode; ListSubItem subitems; } so what do I do, make friends and items multivalued properties of each entity? Then class Item has a list of class Subitems (but no further subsubitems). What do I do? Each entity can have a multivalued property, but then each property cannot AFAIK have multivalued subproperties. Apologies if I have given object-oriented models of my data, but these result from what the data is in the real world and are inevitable for a description. So, my question is, I have this real world data, but the documentation is not helping me to figure out how to model such data, and I need to figure out how to model it, whether with the low-level API or with JDO, couldn't care less with which API, as long as the design makes sense and is done well. Thank you for your help, (I am not interested in any other aspect of GAE, just the datastore). John Goche -- 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] please help understanding: connection between JDO Java keys and BigTable keys
I have just finished watching the following videos in an attempt to understand JDO and BigTable for the google datastore: http://www.youtube.com/watch?v=2jW2iSKDipY http://www.youtube.com/watch?v=Yl_J-UYE94w http://www.youtube.com/watch?v=pzctc48c0BM http://www.youtube.com/watch?v=tx5gdoNpcZM Now I wonder, take the example where we have an entity of kind Grandparent having an entity of kind Parent having an entity of kind Child as in one of the videos. The key for one of the the Child entities could be: Grandparent:Jane/Parent:Jack/Child:Joe 1. How do I code the class for this instance in JDO (presumably there will be three classes) but I would like to see an implementation where we can see the key values set as part of the key explicitly. Any ideas? 2. I also wonder, what is the difference between using JDOQL to access my data and iterating through the various instances using iterators programmatically? Thanks, John Goche -- 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 server availability
Hello, Has anyone been experiencing availability problems when deploying to app engine? Here is what I am getting: Verifying availability: Will check again in 1 seconds. Will check again in 2 seconds. Will check again in 4 seconds. Will check again in 8 seconds. Will check again in 16 seconds. Will check again in 32 seconds. Will check again in 60 seconds. Will check again in 60 seconds. Will check again in 60 seconds. Will check again in 60 seconds. Will check again in 60 seconds. ... Anyone else having this issue? Regards, John Goche -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: app engine server availability
The exact error message I'm getting after retrying a few times is: Unable to update app: Version not ready. See the deployment console for more details Unable to update app: Version not ready. The console contins the following message: Will check again in 60 seconds. Will check again in 60 seconds. on backend null. java.lang.RuntimeException: Version not ready. Debugging information may be found in /tmp/appengine-deploy5680317175029902547.log And such file has the following information: Unable to update: java.lang.RuntimeException: Version not ready. at com.google.appengine.tools.admin.AppVersionUpload.commit(AppVersionUpload.java:535) at com.google.appengine.tools.admin.AppVersionUpload.doUpload(AppVersionUpload.java:141) at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:328) at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:52) at com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:400) at com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:148) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) If this is a problem on google's side I hope it get fixed sometime soon. Reagards, John Goche On Fri, Jan 27, 2012 at 2:53 PM, Chris ritterch...@gmail.com wrote: Having the same issue. On Jan 27, 8:49 am, John Goche johngoch...@googlemail.com wrote: Hello, Has anyone been experiencing availability problems when deploying to app engine? Here is what I am getting: Verifying availability: Will check again in 1 seconds. Will check again in 2 seconds. Will check again in 4 seconds. Will check again in 8 seconds. Will check again in 16 seconds. Will check again in 32 seconds. Will check again in 60 seconds. Will check again in 60 seconds. Will check again in 60 seconds. Will check again in 60 seconds. Will check again in 60 seconds. ... Anyone else having this issue? Regards, John Goche -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] WEB-INF/appengine-generated/datastore-indexes-auto.xml
Hello, My eclipse is not placing an *WEB-INF/appengine-generated/* datastore-indexes-auto.xml in place for me as described on http://code.google.com/appengine/docs/java/config/indexconfig.html Anyone know how to get eclipse to generate one automatically? Thanks, John Goche -- 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] anyone know how to deal with: org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed
Hello, If anyone knows how to deal with org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed any help would be greatly appreciated. Here is the code which is throwing the exception: static void persistStore() { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.makePersistent(Data.store); tx.commit(); } finally { if (tx.isActive()) tx.rollback(); pm.close(); } } I don't see anything wrong with the code. Any ideas? John Goche -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] anyone know how to deal with: org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed
Thank you Amy for your reply... On Mon, Jan 30, 2012 at 12:41 AM, Amy Unruh amyu+gro...@google.com wrote: A pointer to the related Stack Overflow question, where I've provided *an* answer, related to needing to fetch child objects before closing the PersistenceManager: http://stackoverflow.com/questions/9049491/org-datanucleus-exceptions-nucleususerexception-object-manager-has-been-closed/ I have tried touching everything as follows, but I still get an exception when I try accessing the data. static XZStore getStoreByEmail(String email) { PersistenceManager pm = PMF.get().getPersistenceManager(); try { ExtentXZStore storeExtent = pm.getExtent(XZStore.class); for (XZStore store : storeExtent) { if (store.getAdmin().getEmail().equals(email)) { XZStore detachedStore = pm.detachCopy(store); detachedStore.setAdmin(pm.detachCopy(store.getAdmin())); detachedStore.setUsers((ListUser) pm.detachCopyAll((store.getUsers(; detachedStore.setInventory((ListItem) pm.detachCopyAll(store.getInventory())); detachedStore.setReceipts((ListReceipt) pm.detachCopyAll(store.getReceipts())); ListSale detachedSales = new ArrayListSale(); for (Sale sale : store.getSales()) { Sale detachedSale = pm.detachCopy(sale); detachedSale.setSaleItems((ListSaleItem) pm.detachCopyAll(sale.getSaleItems())); detachedSales.add(detachedSale); } detachedStore.setSales(detachedSales); detachedStore.setShipments((ListShipment) pm.detachCopyAll(store.getShipments())); detachedStore.setCustomers((ListCustomer) pm.detachCopyAll(store.getCustomers())); detachedStore.setCompany(pm.detachCopy(store.getCompany())); storeExtent.closeAll(); return detachedStore; } } storeExtent.closeAll(); return null; } finally { pm.close(); } } Though, I see that you're not sure whether this is the issue you're running into. You might do a test in which you explicitly fetch the data from every field you'll need to later access in the detatched objects, while you're still in the open PersistenceManager context, and see if this fixes the problem. As you can see I've tried it but it does not fix the problem, unless I also have to access the simple fields such as String, Data, int, long, double, etc... which should have been retrieved automatically I suppose since they are not lists? Thanks, JG On Sun, Jan 29, 2012 at 10:52 AM, John Goche johngoch...@googlemail.comwrote: Hello, If anyone knows how to deal with org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed any help would be greatly appreciated. Here is the code which is throwing the exception: static void persistStore() { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.makePersistent(Data.store); tx.commit(); } finally { if (tx.isActive()) tx.rollback(); pm.close(); } } I don't see anything wrong with the code. Any ideas? John Goche -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: anyone know how to deal with: org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed
On Mon, Jan 30, 2012 at 12:37 AM, Nichole nichole.k...@gmail.com wrote: Do you have fields within your persistable entities in Data.store which are persistable? Yes, all the fields within the persistable entities are also persistent. http://www.datanucleus.org/javadocs/core/2.1/org/datanucleus/store/exceptions/ReachableObjectNotCascadedException.html You can try pm.flush() and temporarily add catch (Throwable t) { t.printStackTrace() for more detail Thanks but where in my code am I supposed to call this pm.flush() call? Thanks, JG On Jan 28, 3:52 pm, John Goche johngoch...@googlemail.com wrote: Hello, If anyone knows how to deal with org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed any help would be greatly appreciated. Here is the code which is throwing the exception: static void persistStore() { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.makePersistent(Data.store); tx.commit(); } finally { if (tx.isActive()) tx.rollback(); pm.close(); } } I don't see anything wrong with the code. Any ideas? John Goche -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: upgrading to datanucleus-appengine 2.0
On Mon, Jan 30, 2012 at 4:44 PM, datanucleus andy_jeffer...@yahoo.comwrote: Also, I did not have a persistence.xml file in eclipse so I copied the one provided on the wiki's link and placed it alongside jdoconfig.xml in hope that this would be enough. And why should you have one? You use one or the other. As per the JDO spec. OK, so JDO uses jdoconfig.xml and JPA uses persistence.xml. Fair enough, so I don't need persistence.xml since I'm using JDO. Why is org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory not being found? Because your jdoconfig.xml/persistence.xml refers to it and you haven't read that link ... OK, I've given a better look at the link and placed org.datanucleus.api.jdo.JDOPersistenceManagerFactory in place of of org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory. I've been at it all day and now the problem I am having is: Could not find the main class: org.datanucleus.enhancer.DataNucleusEnhancer. Program will exit. when I try to run the web application. And I can't find where this DataNucleusEnhancer class is: eclipse/plugins/org.datanucleus.ide.eclipse_3.0.1$ jar tvf *jar|grep Enhancer 2109 Fri Dec 09 07:40:04 CET 2011 org/datanucleus/ide/eclipse/jobs/AutoEnhancer.class 3878 Fri Dec 09 07:40:04 CET 2011 org/datanucleus/ide/eclipse/jobs/EnhancerJob.class 1623 Fri Dec 09 07:40:04 CET 2011 org/datanucleus/ide/eclipse/popup/actions/EnhancerToolAction.class 1307 Fri Dec 09 07:40:04 CET 2011 org/datanucleus/ide/eclipse/preferences/EnhancerPreferencePage$1.class 7416 Fri Dec 09 07:40:04 CET 2011 org/datanucleus/ide/eclipse/preferences/EnhancerPreferencePage.class Any ideas of what I've missed this time? Thanks, JG -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: upgrading to datanucleus-appengine 2.0
Hello, I am still trying the v2.0 installation. I have reinstalled eclipse and the app engine plugin and then followed the instructions at: http://code.google.com/p/datanucleus-appengine/wiki/UpgradingToVersionTwo all went well but in the very last step when I enabled the auto enhancement I got: Exception in thread main java.lang.NoClassDefFoundError: org/datanucleus/enhancer/DataNucleusEnhancer Caused by: java.lang.ClassNotFoundException: org.datanucleus.enhancer.DataNucleusEnhancer at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: org.datanucleus.enhancer.DataNucleusEnhancer. Program will exit. This is the only part which is not working for me. How can I fix it? Thanks, JG -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: upgrading to datanucleus-appengine 2.0
Well, I've finally managed to resolve my problem: The org/datanucleus/enhancer/DataNucleusEnhancer.class was found in eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.6.1.v201201120043r37/new_appengine-java-sdk-1.6.1/lib/opt/tools/datanucleus/v2 but I was including new_appengine-java-sdk-1.6.1/lib/opt/user/datanucleus/v2 instead of new_appengine-java-sdk-1.6.1/lib/opt/tools/datanucleus/v2 in my Window - Preferences - DataNucleus settings. Duh, I really feel like a fool but I'm glad that in the end I was able to follow through the instructions and get there. Regards, JG -- 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] iterating over Extent throwing NullPointerException on extent.closeAll()
Hello, I am running app engine plugin 2.0 RC2 and having the following problem: The following code runs and returns null but... PersistenceManager pm = PMF.get().getPersistenceManager(); try { ExtentXZStore storeExtent = pm.getExtent(XZStore.class); if (storeExtent == null) return null; // should not be null but check just in case storeExtent.closeAll(); return null; } finally { pm.close(); } but iterating over the extent instance throws a NullPointerException even with an empty loop body: PersistenceManager pm = PMF.get().getPersistenceManager(); try { ExtentXZStore storeExtent = pm.getExtent(XZStore.class); if (storeExtent == null) return null; // should not be null but check just in case for (XZStore store : storeExtent) { } storeExtent.closeAll(); // line 223 where null pointer exception is thrown return null; } finally { pm.close(); } - import com.google.appengine.api.datastore.Key; @PersistenceCapable(detachable=true) class XZStore { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; // ... } There are no instances of XZStore in the datastore so I don't know why this is happening, I would have thought the loop would simply be skipped without a problem. java.lang.NullPointerException at com.google.appengine.datanucleus.query.StreamingQueryResult.cacheQueryResults(StreamingQueryResult.java:101) at com.google.appengine.datanucleus.query.StreamingQueryResult.closeResults(StreamingQueryResult.java:94) at org.datanucleus.store.query.AbstractQueryResult.close(AbstractQueryResult.java:137) at org.datanucleus.store.query.Query.close(Query.java:2126) at org.datanucleus.store.query.Query.closeAll(Query.java:2141) at org.datanucleus.store.DefaultCandidateExtent.closeAll(DefaultCandidateExtent.java:102) at org.datanucleus.api.jdo.JDOExtent.closeAll(JDOExtent.java:66) at com.foobar.foo.Data.getStoreByEmail(Data.java:223) I was not having this problem prior to upgrading to 2.0 RC2. Any ideas of why this behavior? Is this a bug or am I doing something wrong? Thanks, JG -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: iterating over Extent throwing NullPointerException on extent.closeAll()
Thanks for the confirmation. Using Query instead of Extent is working for me. On Tue, Jan 31, 2012 at 11:37 AM, datanucleus andy_jeffer...@yahoo.comwrote: Probably a bug, but you could just use the more normal Query q = pm.newQuery(MyClass.class); List results = (List)q.execute(); which is widely tested in Googles tests. It would be good if we added this test case in google's tests since Extent is in the docs: http://code.google.com/appengine/docs/java/datastore/jdo/queries.html or else the docs could be updated to reflect the fact that this is not supported. In any case I'm fine using queries instead since I wasn't completely clear on from the docs what the advantage of using Extent instead of Query would have been if any. Best, JG -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: pm.makePersistent() causes NullPointerException after deletion
Upgrading to datanucleus-appengine plugin 2.0 RC2 and changing Extent to Query also made this problem vanish. Regards, JG On Mon, Jan 30, 2012 at 12:23 AM, John Goche johngoch...@googlemail.comwrote: Hello, I have an object calld XZStore which has a member ListReceipts receipts. I add a receipt and make the store persistent. I do the same a second time. Then I delete the first one and make the store persistent. All good till now. Then, I delete the second receipt and make the store persistent and the operation fails with the following exception: java.lang.NullPointerExceptionjava.lang.NullPointerException at org.datanucleus.store.appengine.DatastorePersistenceHandler.deleteObject(DatastorePersistenceHandler.java:620) at org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.removeAt(DatastoreFKListStoreSpecialization.java:145) at org.datanucleus.store.mapped.scostore.FKListStore.removeAt(FKListStore.java:525) at org.datanucleus.store.mapped.scostore.AbstractListStore.remove(AbstractListStore.java:318) at org.datanucleus.sco.backed.List.remove(List.java:907) at org.datanucleus.sco.SCOListIterator.remove(SCOListIterator.java:145) at org.datanucleus.sco.SCOUtils.updateListWithListElements(SCOUtils.java:828) at org.datanucleus.sco.simple.List.attachCopy(List.java:232) at org.datanucleus.store.fieldmanager.AttachFieldManager.storeObjectField(AttachFieldManager.java:205) at org.datanucleus.state.AbstractStateManager.providedObjectField(AbstractStateManager.java:1037) at com.foobar.foo.XZStore.jdoProvideField(Data.java) at com.foobar.foo.XZStore.jdoProvideFields(Data.java) at org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl.java:2715) at org.datanucleus.state.JDOStateManagerImpl.internalAttachCopy(JDOStateManagerImpl.java:4055) at org.datanucleus.state.JDOStateManagerImpl.attachCopy(JDOStateManagerImpl.java:3987) at org.datanucleus.ObjectManagerImpl.attachObjectCopy(ObjectManagerImpl.java:1778) at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1260) at org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1175) at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:669) at org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:694) at com.foobar.foo.ServerProtocol.deleteReceipt(ServerProtocol.java:431) at com.foobar.foo.ComNetDataServlet.respond(ComNetDataServlet.java:742) at com.foobar.foo.ComNetDataServlet.doPost(ComNetDataServlet.java:55) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:60) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:78) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:362) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542
[appengine-java] Does this cause any problems with JDO on app engine?
Hello, The following scenario was giving me problems: @PersistenceCapable class Store { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent User admin; @Persistent ListUser otherUsers; } because User appears twice within Store, so the framework was not letting me do it. My workaround was to define a new class with the following: @PersistenceCapable class Store { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent AdminUser admin; @Persistent ListRegularUser otherUsers; } but the problem is that I have functions that take User instances as arguments and that return User instances and I would like to not have to write separate functions for RegularUser and AdminUser. So, I was wondering, if in addition to the above I were to add the following: @PersistenceCapable @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) public abstract class User { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; } @PersistenceCapable public class AdminUser extends User { } @PersistenceCapable public class RegularUser extends User { } would this work? Note that with this scheme I will never persist references to the abstract User type which will just be used in the arguments and return values of functions in my code for convenience. From what I gather on this page http://code.google.com/appengine/docs/java/datastore/jdo/relationships.html with this scheme I would only run into trouble if I were to call pm.makePersistent(user) where user is defined as User user; . I would not run into trouble if I call pm.makePersistent(store) because the calss store does not reference abstract class User. Am I correct in making this assumption? I am going to try it out. Please let me know if you foresee any problems with this scheme. Regards, JG -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: makePersistent failing every second time since server restart
Hi, I've raised the issue with a test case in google's issue tracker: http://code.google.com/p/datanucleus-appengine/issues/detail?id=259 I am hoping someone can kindly have a look at it and get back to me as I cannot see how I can make use of JDO on app engine without this fixed. In the meantime any suggestions on how to work around the problem would be greatly appreciated. Kind Regards, John Goche On Wed, Feb 1, 2012 at 9:21 AM, datanucleus andy_jeffer...@yahoo.com wrote: So it can't find a related Entity. You could obviously use the DB viewer (or a low level API call) to check whether it is present (with that Key), and look in the log for whether it was PUT. Can't speak for Google but I'm sure nobody has interest in private code, though I'm sure that it ought to be perfectly simple to generate a testcase something akin to the format used by DataNucleus http://www.datanucleus.org/project/problem_jdo_testcase.html if the issue is as clear as you say in terms of reproducing it. And then you can raise an issue in Googles issue tracker with the testcase; obviously without the testcase then nobody, other than you, can see 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-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: makePersistent failing every second time since server restart
NIchole, Thank you for your feedback, but how do I change my code so that I have this entity group you are mentioning? I am using the HR datastore. And how did you get to this conclusion? I am fetching every store from the datastore, detaching everything after making it persistent, and always touching fields before accessing them, so why are things not working out? @PersistenceCapable(detachable=true) class ZZZStore { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private AdminUser admin; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=email asc)) private ListRegularUser users; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=itemCode asc)) private ListItem inventory; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=receiveDate asc, receiptID asc)) private ListReceipt receipts; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=saleID asc)) private ListSale sales; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=shipDate asc)) private ListShipment shipments; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=cusID asc)) private ListCustomer customers; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) private Company company; } @PersistenceCapable class Sale { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private long saleID; @Persistent private Date saleDate; @Persistent private String cusID; @Persistent private String repID; @Persistent //@Persistent(defaultFetchGroup = true) private ListSaleItem saleItems; } static void persistStore() { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.makePersistent(Data.store); tx.commit(); } finally { if (tx.isActive()) tx.rollback(); pm.close(); } } On Thu, Feb 2, 2012 at 11:01 AM, Nichole nichole.k...@gmail.com wrote: you need an entity group http://code.google.com/appengine/docs/java/datastore/jdo/relationships.html or cross group transactions if you are using the HR datastore: http://code.google.com/appengine/docs/python/datastore/transactions.html or If you are not on the HR datastore and need 2-phase locking transactions: http://groups.google.com/group/google-appengine-java/browse_thread/thread/497060c343e16052/18f8603e9ffe3db4?lnk=gstq=Good+point+++nichole#18f8603e9ffe3db4 On Feb 1, 10:25 am, John Goche johngoch...@googlemail.com wrote: Hi, I've raised the issue with a test case in google's issue tracker: http://code.google.com/p/datanucleus-appengine/issues/detail?id=259 I am hoping someone can kindly have a look at it and get back to me as I cannot see how I can make use of JDO on app engine without this fixed. In the meantime any suggestions on how to work around the problem would be greatly appreciated. Kind Regards, John Goche On Wed, Feb 1, 2012 at 9:21 AM, datanucleus andy_jeffer...@yahoo.com wrote: So it can't find a related Entity. You could obviously use the DB viewer (or a low level API call) to check whether it is present (with that Key), and look in the log for whether it was PUT. Can't speak for Google but I'm sure nobody has interest in private code, though I'm sure that it ought to be perfectly simple to generate a testcase something akin to the format used by DataNucleus http://www.datanucleus.org/project/problem_jdo_testcase.html if the issue is as clear as you say in terms of reproducing it. And then you can raise an issue in Googles issue tracker with the testcase; obviously without the testcase then nobody, other than you, can see 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-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
[appengine-java] writing then reading entity does not fetch entity from datastore
Hello, I am having the following problem. I am now using the low-level google datastore API rather than JDO, that way I should be in a better position to see exactly what is happening in my code. I am writing an entity to the datastore and shortly thereafter reading it from the datastore using Jetty and eclipse. Sometimes the written entity is not being read. This would be a real problem if it were to happen in production code. I am using the 2.0 RC2 API. I have tried this several times, sometimes the entity is retrieved from the datastore and sometimes it is not. I am doing a simple query on the datastore just after committing a write transaction. (If I run the code through the debugger things run slow enough that the entity has a chance of being read back on the second pass). Any help with this issue would be greatly appreciated, Regards, John Goche -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] writing then reading entity does not fetch entity from datastore
Thanks Ikai for your help, I was indeed running a global query and not reading by key. This was in the dev app server which AFAIK reproduces the behavior of the datastore. I would like to know, if you don't mind me asking, suppose I am not reading by key. Once a query becomes consistent, that is, I find everything the query was supposed to find, and this happens on client computer A, at that point can I assume the same will happen from any other client computer, that is, once a query appears to have become consistent can I a On Sat, Feb 4, 2012 at 2:28 AM, Ikai Lan (Google) ika...@google.com wrote: Can you post the code? Are you reading by key? If you are using a query, you might be exposed to the eventually consistent nature of global queries in the datastore. Or is this only in the dev appserver? -- Ikai Lan Developer Programs Engineer, Google App Engine plus.ikailan.com Matthew, Not a stupid question at all. Unfortunately it is not in my best interest to put everything in the same entity group, for instance because there is a limitation as to the amount of interactions with the server per unit time period for entities in the same entity group. And if one uses the high replication server and does not query by key one will be exposed to this constraint. On Sat, Feb 4, 2012 at 3:16 AM, Matthew Jaggard matt...@jaggard.org.uk wrote: I hope this is a stupid question but you're not setting the read consistency to eventual are you? Best Regards, John Goche -- 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.