title: EclipseLink cannot find entity in OneToMany relationship
body: <p>I have a very simple case with eclipse link which I have reproduced below. If I can get the below example working, then I can easily apply it to the actual case in question. Problem is, I can't!</p>
  
  <p>There are two classes - <code>Parent</code> and <code>Child</code>. Both have a <code>String</code> id, and the <code>Parent</code> contains a list of <code>Child</code> objects in the field <code>children</code>. The <code>List</code> of children has the attributed <code>@OneToMany</code>, and both classes have the <code>@Entity</code> attribute. I am running everything through Eclipse as a Maven project, with the <code>persistence.xml</code> stored in <code>src\main\resources\META_INF\persistence.xml</code>. No other jars are referenced.</p>
  
  <p>When I call <code>Persistence.createEntityManagerFactory</code> I get the following exception. It seems to think <code>Child</code> is not an entity!</p>
  
  <pre><code>Exception in thread "main" Local Exception Stack: 
  Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
  Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@1a8e3115
  Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Predeployment of PersistenceUnit [Parent] failed.
  Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.ValidationException
  Exception Description: [class com.test.Parent] uses a non-entity [class com.test.Child] as target entity in the relationship attribute [field children].
      at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
      at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:107)
      at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
      at com.test.Main.main(Main.java:22)
  Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Predeployment of PersistenceUnit [Parent] failed.
  Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.ValidationException
  Exception Description: [class com.test.Parent] uses a non-entity [class com.test.Child] as target entity in the relationship attribute [field children].
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:1950)
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1941)
      at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:98)
      at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:96)
      ... 3 more
  Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Predeployment of PersistenceUnit [Parent] failed.
  Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.ValidationException
  Exception Description: [class com.test.Parent] uses a non-entity [class com.test.Child] as target entity in the relationship attribute [field children].
      at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:230)
      ... 7 more
  Caused by: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.ValidationException
  Exception Description: [class com.test.Parent] uses a non-entity [class com.test.Child] as target entity in the relationship attribute [field children].
      at org.eclipse.persistence.exceptions.ValidationException.nonEntityTargetInRelationship(ValidationException.java:1378)
      at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.RelationshipAccessor.getReferenceDescriptor(RelationshipAccessor.java:568)
      at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.RelationshipAccessor.processJoinTable(RelationshipAccessor.java:725)
      at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.OneToManyAccessor.processManyToManyMapping(OneToManyAccessor.java:198)
      at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.OneToManyAccessor.process(OneToManyAccessor.java:147)
      at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processOwningRelationshipAccessors(MetadataProject.java:1578)
      at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage3(MetadataProject.java:1831)
      at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:580)
      at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:585)
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1865)
      ... 5 more
  </code></pre>
  
  <p>I've tried so many things around this and I really have no idea what to try next. I assume I'm doing something horribly wrong, but google has finally exauhsted itself. Any help much appreciated :)</p>
  
  <p>All relevant files to reproduce are below:</p>
  
  <p>Parent:</p>
  
  <pre><code>package com.test;
  
  import java.util.List;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.OneToMany;
  
  @Entity
  public class Parent {
      @Id
      private String      id;
      @OneToMany
      private List&lt;Child&gt; children;
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public List&lt;Child&gt; getChildren() {
          return children;
      }
  
      public void setChildren(List&lt;Child&gt; children) {
          this.children = children;
      }
  }
  </code></pre>
  
  <p>Child:</p>
  
  <pre><code>package com.test;
  
  import javax.persistence.Entity;
  import javax.persistence.Id;
  
  @Entity
  public class Child {
      @Id
      private String id;
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  }
  </code></pre>
  
  <p>persistence.xml:</p>
  
  <pre><code>&lt;persistence version="1.0"
      xmlns="http://java.sun.com/xml/ns/persistence"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.
  
      &lt;persistence-unit name="Parent"&gt;    
          &lt;class&gt;com.test.Parent&lt;/class&gt;      
          &lt;properties&gt;        
              &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/&gt;      
              &lt;property name="eclipselink.jdbc.read-connections.min" value="1" /&gt;
              &lt;property name="eclipselink.jdbc.write-connections.min" value="1" /&gt;
              &lt;property name="eclipselink.jdbc.batch-writing" value="JDBC" /&gt;         
              &lt;property name="eclipselink.ddl-generation" value="create-or-extend-tables"/&gt;
              &lt;property name="eclipselink.ddl-generation.output-mode" value="database"/&gt;
              &lt;!-- Logging --&gt;
              &lt;property name="eclipselink.logging.level" value="INFO" /&gt;
              &lt;property name="eclipselink.logging.timestamp" value="true" /&gt;
              &lt;property name="eclipselink.logging.session" value="true" /&gt;
              &lt;property name="eclipselink.logging.thread" value="false" /&gt;                                
          &lt;/properties&gt;       
      &lt;/persistence-unit&gt; 
  
      &lt;persistence-unit name="Child"&gt; 
          &lt;class&gt;com.test.Child&lt;/class&gt;       
          &lt;properties&gt;        
              &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/&gt;      
              &lt;property name="eclipselink.jdbc.read-connections.min" value="1" /&gt;
              &lt;property name="eclipselink.jdbc.write-connections.min" value="1" /&gt;
              &lt;property name="eclipselink.jdbc.batch-writing" value="JDBC" /&gt;         
              &lt;property name="eclipselink.ddl-generation" value="create-or-extend-tables"/&gt;
              &lt;property name="eclipselink.ddl-generation.output-mode" value="database"/&gt;
              &lt;!-- Logging --&gt;
              &lt;property name="eclipselink.logging.level" value="INFO" /&gt;
              &lt;property name="eclipselink.logging.timestamp" value="true" /&gt;
              &lt;property name="eclipselink.logging.session" value="true" /&gt;
              &lt;property name="eclipselink.logging.thread" value="false" /&gt;                                
          &lt;/properties&gt;       
      &lt;/persistence-unit&gt; 
  
  
  &lt;/persistence&gt;
  </code></pre>
  
  <p>Main class (for testing):</p>
  
  <pre><code>package com.test;
  
  import java.util.HashMap;
  import java.util.Map;
  import javax.persistence.Persistence;
  
  public class Main {
      private static final String KEY_PERSISTENCE_URL  = "javax.persistence.jdbc.url";
      private static final String KEY_PERSISTENCE_USER = "javax.persistence.jdbc.user";
      private static final String KEY_PERSISTENCE_PASS = "javax.persistence.jdbc.password";
  
      public static void main(String[] args) {
          Map&lt;String, String&gt; properties = new HashMap&lt;&gt;();
          properties.put(KEY_PERSISTENCE_URL, "jdbc:mysql://localhost:3306/reporting");
          properties.put(KEY_PERSISTENCE_USER, "root");
          properties.put(KEY_PERSISTENCE_PASS, "p4ssw0rd");
          Persistence.createEntityManagerFactory(Parent.class.getSimpleName(), properties);
      }
  }
  </code></pre>