Saturday, July 25, 2009

Fix: Google App Engine Java: Field "X" does not exist in class B or is not persistent

Just in case it help anybody with a similar problem:

I'm using JDO on Google App Engine, and had a problem with a javax.jdo.Query query when searching for all items with a particular key. In my structure, class Item has field Key listKey, and class Task extends Item. Executing a query for Task specifying the field listKey kept getting the exception
Field "listKey" does not exist in class Task or is not persistent
even though it definitely had the field, and I could see the data with the correct field name in the data explorer. The only fix that worked was removing the field from the Item class and adding it to the Task class.

Also, to use a Key in the query, I had to add this to the query:
query.declareImports("import com.google.appengine.api.datastore.Key");

Saturday, April 18, 2009

Visual Studio: close the start page when opening a project

It's a small thing, but I get irritated having to close the Start Page in Visual Studio after I've opened a project. Eric Faust shows you how to write a plugin to have that happen automatically, and gives you a downloadable plugin as well.

Two notes:
  • If you use the downloadable version, you might need to unblock the zip file as Internet files aren't trusted.  Right-click, properties, click "Unblock".
  • Edit StartPageCloser.AddIn and change the to:
    StartPageCloser.dll
Once you've done that, built the Release version and copy the StartPageCloser.AddIn and  StartPageCloser.dll to your plugins directory.  On VS2008 that's Documents\Visual Studio 2008\AddIns - and I had to create the AddIns directory myself.