-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to auto drop or delete tables?
PostPosted: Tue Mar 21, 2006 3:05 pm 
Newbie

Joined: Mon Jan 09, 2006 8:14 pm
Posts: 3
I have a properties file that determines which server of two I have to access data. The server will be either in development or production and they all contain different test data.

The problem I have is that if I access a dev database and then alter my properties file to point to prod, all of the cached data I am reading from would be invalid.

Is there something I can do in Hibernate that would tell it to either auto drop those tables or delete all records when i switch servers?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 3:28 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
somehow I don't think this will help since I think your quest lies deeper than this... but to directly answer your question -- you can drop tables with:

//if Oracle only! (from the test code).

Code:
   if ( !( getDialect() instanceof Oracle9Dialect ) ) return;
   
    Session s = openSession();
   
    Statement st = s.connection().createStatement();
    try {
   st.execute( "drop table Point");
    }
    catch( Throwable t ) {
   // ignore
    }
    st.execute("create table Point (\"x\" number(19,2) not null, \"y\"" +
                    " number(19,2) not null, description varchar2(255) )");
    s.close();


the part I am having trouble understanding with your question is:
Quote:
The problem I have is that if I access a dev database and then alter my properties file to point to prod, all of the cached data I am reading from would be invalid.

"access a dev database" via how?
"alter my properties" - hibernate properties?
"all the cached data" - hibernate cached? at server or client

Can you explain your intended config a little more...
thx.

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.