title: How to persist models entity in playframework submodule using jpa/hibernate
body: <p>I have project in PLAY FRAMEWORK which contain few submodules.</p>
  <p>Each submodule has folder structure like this:</p>
  <pre><code> - app:
    - controllers
    - **models**
    - views
   - conf:
    - submodulename.routes
   - build.sbt
  </code></pre>
  <p>I would like to persist all java class entities in folder: <strong>models</strong>.</p>
  <p>How should I configure play framework and/or hibernate entity manager to scan this folders for entities.</p>
  <p>I have example model class as follow:</p>
  <pre><code>package models.common;
  
  import javax.persistence.CascadeType;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.ManyToOne;
  import javax.persistence.NoResultException;
  
  import controllers.common.Index;
  import play.data.validation.Constraints;
  import play.db.jpa.JPA;
  
  @Entity
  public class AppMode {
      public static AppMode getCurrentConfigurationEntry() {
          return JPA.em().find(AppMode.class, 1L);
      }
  //rest of code here- not important//
  }
  </code></pre>
  <p>but in this state jvm return me a runtime error:</p>
  <blockquote>
  <p>[IllegalArgumentException: Unknown entity: models.common.AppMode]</p>
  </blockquote>
  <p>NOTE : I'm using play 2.2.1</p>
  <p>I've noticed that hibernate is correctly create SQL structure for AppMode entity
  when I set this in persistance.xml:</p>
  <pre><code>    &lt;property name=&quot;hibernate.hbm2ddl.auto&quot; value=&quot;create-drop&quot;/&gt;
  </code></pre>
  <p>But when I go further I am getting next error:</p>
  <blockquote>
  <p>[IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: MIncident is not mapped</p>
  </blockquote>
  <p>While I have annotation @Entity on that class.</p>
  <p><strong>It seems to be correct mapped, but I can't do any operation like <code>hsql select</code> or <code>JPA.em().find()</code> on that entities</strong></p>