title: JPA on google app engine Type ("XXX") is not that of an entity but needs to be for this operation
body: <p>Hi I have an entity class annotated with @Entity so it could be persisted with JPA on google app engine.</p>
  
  <p>My class looks like this:</p>
  
  <pre><code>@Entity
  public class DataUrls {
  
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Key key;
  
  private String postalCode;
  
  private List&lt;String&gt; urls;
  
  public Key getKey() {
      return key;
  }
  
  public void setKey(Key key) {
      this.key = key;
  }
  
  public String getPostalCode() {
      return postalCode;
  }
  
  public void setPostalCode(String postalCode) {
      this.postalCode = postalCode;
  }
  
  public List&lt;String&gt; getUrls() {
      return urls;
  }
  
  public void setUrls(List&lt;String&gt; urls) {
      this.urls = urls;
  }
  }
  </code></pre>
  
  <p>I'm using maven to build my project and at compile phase enhance the classes, in my logging I see the following:</p>
  
  <pre><code>[INFO] --- maven-datanucleus-plugin:3.1.1:enhance (default) @ grabby-backend ---
  [INFO] DataNucleus Enhancer (version 3.1.1) : Enhancement of classes
  DataNucleus Enhancer completed with success for 1 classes. Timings : input=181 ms,     enhance=60 ms, total=241 ms. Consult the log for full details
  
  [ERROR] --------------------
  [ERROR]  Standard error from the DataNucleus tool +     org.datanucleus.enhancer.DataNucleusEnhancer :
  [ERROR] --------------------
  [ERROR] Nov 14, 2013 5:00:01 PM org.datanucleus.enhancer.DataNucleusEnhancer &lt;init&gt;
  INFO: DataNucleus Enhancer for API "JPA"
  Nov 14, 2013 5:00:02 PM org.datanucleus.enhancer.DataNucleusEnhancer main
  INFO: DataNucleus Enhancer (version 3.1.1) : Enhancement of classes
  Nov 14, 2013 5:00:02 PM org.datanucleus.metadata.MetaDataManager loadFiles
  WARNING: Metadata file -enhancerName not found in CLASSPATH
  Nov 14, 2013 5:00:02 PM org.datanucleus.metadata.MetaDataManager loadFiles
  WARNING: Metadata file ASM not found in CLASSPATH
  Nov 14, 2013 5:00:02 PM org.datanucleus.enhancer.AbstractClassEnhancer save
  INFO: Writing class file "/Development/datagrabber-backend/grabby-    backend/target/classes/com/appspot/datagrabby/model/entities/DataUrls.class" with enhanced     definition
  Nov 14, 2013 5:00:02 PM org.datanucleus.enhancer.DataNucleusEnhancer addMessage
  INFO: DataNucleus Enhancer completed with success for 1 classes. Timings : input=181 ms,     enhance=60 ms, total=241 ms. Consult the log for full details
  </code></pre>
  
  <p>and the config in maven looks like this:</p>
  
  <pre><code>&lt;plugin&gt;
              &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
              &lt;artifactId&gt;maven-datanucleus-plugin&lt;/artifactId&gt;
              &lt;version&gt;${datanucleus.jpa.version}&lt;/version&gt;
  
              &lt;configuration&gt;
                  &lt;api&gt;JPA&lt;/api&gt;
                  &lt;metadataIncludes&gt;com/appspot/blabla/model/entities/*.class&lt;/metadataIncludes&gt;
                  &lt;verbose&gt;true&lt;/verbose&gt;
                  &lt;enhancerName&gt;ASM&lt;/enhancerName&gt;
              &lt;/configuration&gt;
  
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
                      &lt;artifactId&gt;datanucleus-core&lt;/artifactId&gt;
                      &lt;version&gt;${datanucleus.jpa.version}&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
  
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;compile&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;enhance&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>the persistence code:</p>
  
  <pre><code>    public void persistDataURLs(DataUrls dataUrls){
          EntityManager em = EMF.getFactory().createEntityManager();
          em.persist(dataUrls);
          em.close();
      }
  </code></pre>
  
  <p>However when I try to write to the database I get following message:</p>
  
  <pre><code>Type ("XXX") is not that of an entity but needs to be for this operation
  </code></pre>
  
  <p>I understand why the application is saying this, however since the logging of the enhancer plugin notifies that the class is enhanced I wonder why this is happening.</p>