title: Hibernate: Overriding hibernate.default_schema property in persistence.xml
body: <p>I have my default schema declared in persistence.xml as:</p>
  
  <pre><code>&lt;property name="hibernate.default_schema" value="MYSCHEMA" /&gt;
  </code></pre>
  
  <p>However, now I want to access one table from CURRSCHEMA which is in the same database.</p>
  
  <p>Entity is created as say Currency for Curreny table in CURRSCHEMA.</p>
  
  <p>But running the below query tries to access MYSCHEMA.Currency which results in error.</p>
  
  <pre><code>// here will go the code to fetch currency
  String currencySql = "select C.pk.currCode from Currency C where C.pk.idCode = :idCode";
  Query currencyQuery = this.em.createQuery(currencySql);
  currencyQuery.setParameter("idCode", "CCY");
  </code></pre>
  
  <p>My entities are using annotations:</p>
  
  <pre><code>@Entity
  @Table(name="CURRENCY")
  public class Currency implements Serializable {
  </code></pre>
  
  <p>Changing @Table(name="CURRENCY") to @Table(name="CURRSCHEMA.CURRENCY") did not work.</p>
  
  <p>How to go about this ?</p>