-->
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: transaction across several identical database schemas
PostPosted: Thu Dec 15, 2005 11:07 am 
Newbie

Joined: Thu Dec 15, 2005 10:46 am
Posts: 2
I would like to know the best method to perform a transaction accross several database schema that consists exactly in the same model (I can't specify the schema in the mapping, it has to be dynamic).

To keep the same session across operation on each schema,
i've first tried to programmatically re-set the default schema value in the PersistantClass :

Code:
configuration.setProperty("hibernate.default_schema", newShemaName) ;
for(Iterator it = configuration.getClassMappings(); it.hasNext(); ) {
    PersistentClass pc = (PersistentClass)it.next();          
    pc.getTable().setSchema(newShemaName);
}


But this approache requires to rebuild the SessionFactory and to create a new Session - (and i don't think it's possible to have a transaction across several session, right?).

Any ideas ?
Thanks a lot. Keep on good work!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 16, 2005 10:03 am 
Newbie

Joined: Thu Dec 15, 2005 10:46 am
Posts: 2
I found a workaround : Get the underlying jdbc connection and perform
a low-level default schema change.

Code:
ALTER SESSION SET CURRENT_SCHEMA = newSchema;

The problem is that this query is vendor dependent...

Bye


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.