-->
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: changes to the schema while hibernate is running
PostPosted: Mon Oct 25, 2010 1:00 am 
Beginner
Beginner

Joined: Thu Jul 22, 2004 10:51 pm
Posts: 29
Location: sydney australia
Hi all,

I'm working on a high usage system which maps a few "read only" tables and views. At various points in time I need to replace the data in these tables with a newer version by connecting to the database externally.

We are using postgres 8.3+ and hibernate 3.2.6. The external "update" process will be connecting to the db via PSQL.

For some of the smaller tables, a truncate and insert within a transaction should be satisfactory.

However some of the tables are quite large and the truncate/insert method will probably lock the table for too long.

In this case I am considering either:

1) table rename - ie load new data into table_b while hibernate is mapped to table_a and then perform a table rename from table_b->table_a via PSQL

-or-

2) always map hibernate to a view, and when table_b is populated re-define the view to route to table_b instead of the now redundant table_a.

-or-

3) create and populate a new schema, and change the hibernate user's search path once the new schema is ready

I'm not 100% sure of the repercussions of these approaches within hibernate, and although I am about to test as best I can it will be hard to test collisions (ie a hibernate query to the table at the point it is being renamed) so some theoretical opinions would be much appreciated.

if anyone has attempted similar approaches or knows of the potential pitfalls I'd be very grateful..

p.


Top
 Profile  
 
 Post subject: Re: changes to the schema while hibernate is running
PostPosted: Mon Oct 25, 2010 11:21 am 
Senior
Senior

Joined: Fri Oct 08, 2010 8:44 am
Posts: 130
PostgreSQL supports transaction isolation on schema level too. You should be able to access the table in one transaction while dropping it in another, but you better ask how to do it on PostgreSQL forum.


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.