persistence@glassfish.java.net

Re: How to check for table existence?

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Mon, 29 Oct 2007 08:25:16 -0400

There is no spec defined means to test for table existence. However,
if you know the table name build and execute a native query selecting
from the table. If a Persistence exception occurs then the table does
not exist. If you do not know the table name you can also execute a
JPQL query for the Entity and check for a Persistence Exception.
--Gordon

Farrukh Najmi wrote:
>
> What is the best way for my JPA client to check for existence of a table?
> I did not find anything in the archives on this. TIA.
>