title: Hibernate database name change gives MySQLSyntaxErrorException: Table doesn't exist
body: <p>I used to have a database called <code>database</code> and everything was working well using hibernate and its models.</p>
  
  <p>I removed <code>&lt;property name="hibernate.hbm2ddl.auto"&gt;</code> to avoid update or create as it's a production server, we want to do it manually.</p>
  
  <p>We recently switched to <code>database2</code> and so we switched the hibernate configuration file and all the hibernate XML models.</p>
  
  <pre><code>`&lt;class name="com.api.models.database.MmApplications" table="mm_applications" catalog="database2"&gt;`
  </code></pre>
  
  <p>but it keeps looking for <code>database</code> event if we migrated the database, the models and the connexion.</p>
  
  <pre><code> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'database.mm_applications' doesn't exist
  </code></pre>
  
  <p>Does someone can help me ?</p>
  
  <p>UPDATE ----</p>
  
  <p>Hibernate is connecting to the right database (database2), but there is a prefix as a prefix <code>database.</code> making the queries hitting the <code>database</code> instead of <code>database2</code>, and when I try to force the <code>default_schema</code> my queries become : </p>
  
  <pre><code>`... from database.database2.mm_applications ....`
  </code></pre>
  
  <p>Any idea? </p>