title: Get DB schema name in JPA (from EntityManager/EntityManagerFactory)
body: <p>In JPA (EclipseLink 2.4) I need to specify schema name in NativeQuery:</p>
  
  <pre><code>EntityManager em = emf.createEntityManager();
  Query query = em.createNativeQuery("select foo from bar.table");
  </code></pre>
  
  <p>Above works but obviously I don't like hardcoding schema name, especially given the fact that I'm already specifying it in orm.xml:</p>
  
  <pre><code>&lt;entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
      version="2.0"&gt;
      &lt;persistence-unit-metadata&gt;
          &lt;persistence-unit-defaults&gt;
              &lt;schema&gt;bar&lt;/schema&gt;
          &lt;/persistence-unit-defaults&gt;
      &lt;/persistence-unit-metadata&gt;   
  &lt;/entity-mappings&gt;
  </code></pre>
  
  <p>Surely there must be a way to get schema name on runtime from somewhere?</p>