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!