persistence@glassfish.java.net

Re: How to delete all tables in a database

From: James Sutherland <jamesssss_at_yahoo.com>
Date: Mon, 29 Oct 2007 06:03:02 -0700 (PDT)

You could use a native Query in JPA using DDL specific to your database to
drop the entire schema, or drop each table one by one.

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 all the tables and then drop them one by one.

TopLink also provides some schema creation classes in
oracle.toplink.tools.schemaframework, which may be useful to you. You can
also configure TopLink to recreate your database on startup using the
persistence XML schema creation properties.


Farrukh Najmi-2 wrote:
>
>
> What is the best way for my JPA client to delete all tables in a
> database? 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-delete-all-tables-in-a-database-tf4704442.html#a13467060
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.