title: Hibernate Default Schema not working
body: <p>I'm trying to set a default schema in my Hibernate mapping, like so:</p>
  
  <pre><code>&lt;persistence-unit name="store"&gt;
  
      &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
      &lt;jar-file&gt;store-data-0.0.4-SNAPSHOT.jar&lt;/jar-file&gt;
  
      &lt;properties&gt;
          &lt;property
              name="hibernate.show_sql"
              value="true" /&gt;
          &lt;property
              name="hibernate.format_sql"
              value="true" /&gt;
          &lt;property
              name="hibernate.default_schema"
              value="Store"&gt;&lt;/property&gt;
          &lt;property
              name="hibernate.archive.autodetection"
              value="class" /&gt;
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p>However, when I run a simple test query:</p>
  
  <pre><code>@PersistenceContext
  private EntityManager manager;
  
  @Transactional
  public List&lt;Person&gt; listPeople() {
      return manager.createQuery("SELECT p FROM Person p", Person.class).getResultList();
  }
  </code></pre>
  
  <p>I get this: </p>
  
  <p>Invalid object name 'Person'.</p>
  
  <p>When I run a native query:</p>
  
  <pre><code>manager.createNativeQuery("SELECT * FROM Store.Person", Person.class).getResultList();
  </code></pre>
  
  <p>Everything works fine.</p>
  
  <p>I'm running a SE application, using Spring. I have used the <code>hibernate.default_schema</code> in a Web App before, and it worked just fine.</p>
  
  <p>This is how I declare the entities mapping:</p>
  
  <pre><code>&lt;bean
      id="entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
      &lt;property
          name="dataSource"
          ref="mysqlDataSource" /&gt;
      &lt;property
          name="packagesToScan"
          value="com.base.package" /&gt; &lt;!-- base package for all my entities --&gt;
      &lt;property name="jpaVendorAdapter"&gt;
          &lt;bean
              class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Any thoughts?</p>