title: In JPA, is there a DB agnostic way to check if a table exists?
body: <p>I'm wondering if there's a db agnostic way to check if a certain table exists in JPA (specifically, eclipse link).  Right now the way we do it is with a native query like this:</p>
  
  <pre><code>select count(*) from table_name where 1=2
  </code></pre>
  
  <p>If this throws an exception, we know the table doesn't exist.  And, as far as I know, this will work on most SQL databases.  The thing I don't is it's a hacky query and it throws a SQL exception when the table doesn't exist.  I'd prefer to be able to do a query that returns a <code>true</code>/<code>false</code> instead of a <code>no error</code>/<code>error</code>. But the only way I know how to do that is to query data dictionaries, and that won't be database agnostic.  </p>
  
  <p>In JPA, is there a DB agnostic way to check if a table exists? </p>