persistence@glassfish.java.net

Re: How to check for table existence?

From: James Sutherland <jamesssss_at_yahoo.com>
Date: Mon, 29 Oct 2007 05:59:28 -0700 (PDT)

You could use a native Query in JPA using SQL, such as "Select * from
<table>", and catch the exception if the table does not exist (set
maxResults to 1).

You could also get a handle on a JDBC connection directly from your
DataSource (or possibly from your TopLink Session) and use the JDBC
Connection MetaData to query if the table exists.



Farrukh Najmi-2 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.
>
> --
> Regards,
> Farrukh
>


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.oracle.com/technology/products/ias/toplink/ Oracle TopLink , 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  https://glassfish.dev.java.net/javaee5/persistence/ TopLink
Essentials 
Wiki:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence , 
http://wiki.eclipse.org/EclipseLink EclipseLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink , 
http://www.nabble.com/java.net---glassfish-persistence-f13455.html Glassfish
Persistence 
-- 
View this message in context: http://www.nabble.com/How-to-check-for-table-existence--tf4704402.html#a13466998
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.