-->
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.  [ 3 posts ] 
Author Message
 Post subject: Changing db table owner at run-time (using schema attribute)
PostPosted: Thu Jun 23, 2005 1:07 pm 
Hi
We have a need to be able to change the owner (schema) of our underlying tables in the .xml mapping files without having to recompile our applications. To clarify consider the below:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
   <class name="DataAccess.NHibernate.AoDate, .DataAccess.NHibernate"
   table="AODATE" schema="TestOwner">

   <id name="AsOfDate" column="AS_OF_DATE" type="Date" length="4"> <generator class="assigned"></generator></id>
   
   <property name="ReportingDate" column="REPORTING_DATE" type="Date" length="4"></property>

   </class>
</hibernate-mapping>


In the test region of our system we have a development region, a QA region and a region that mirrors prod. These are differentiated by schema name. We need to be able to swap regions based on a config value or the like and not have to hardcode the owner name. Nobody is going to sign off on an app that needs to be recompiled to swap regions - too much risk involved and testing in production is out. Is there an easy way to set the schema value at runtime?

Thanks,
Robin


Top
  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 1:11 pm 
Regular
Regular

Joined: Mon May 16, 2005 2:15 pm
Posts: 59
Set the hibernate.default_schema in your configuration file and don't specify the schema in the mapping files.

Then it should be just a config file change.

BOb


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 1:29 pm 
Most awesome.

Thanks


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.