If you are using Ant for building, it has some wonderful capabilities here. 
Specifically look into the filtering capabilities.  

It is possible to do the following:
  <filter token="SCHEMA" value="PRODUCTION_SCHEMA" />

Then, when you copy a file do the following:
  <copy todir=".." filtering="true">
    ..
  </copy>


Not sure if this is exactly what you had in mind, but I think it could
accomplish the same thing.

-josh



"McCaffrey, John G." <[EMAIL PROTECTED]> wrote:
> I also ran into this issue, as well as the need to dynamically change the
> schema between environments (development, test, stage, Production - all
> point to different databases/schemas)
> 
> I solved this using the following
> 1. each server has a systemProperty "env" that indicates whether it is
"dev"
> or "test" or "prod"
> 2. I have an Servlet.init() that calls System.getProperty("env"); and loads
> the right OJB and log4J files 
> 
> for example when I deploy to the "test" server
> 3. in test_OJB.properties: 
>       the repositoryFile =OJB/test_repository.xml
> 4. in test_repository.xml:
>       <!DOCTYPE descriptor-repository SYSTEM "repository.dtd" [
>               ENTITY internal SYSTEM "repository_internal.xml"
>               ENTITY user SYSTEM "repository_user.xml"
>               ENTITY schema "$TEST" 
>       ]>
> 5. in user_repository.xml  
>       <class-descriptor class="c.k.e.m.c.d.d.CustomerVO" schema="&schema;"
> table="CUSTOMER_TABLE">
>       (schema= is the important part. &schema; is the entity defined
> above)
> 
> 6. in my SequenceManagerMSFImpl.getCustomerSeq()
>       ClassDescriptor cld =
> persistanceBroker.getClassDescriptor(CustomerVO.class);
>       String current_env = cld.getSchema()+"."; //will = $TEST or #DSNA
>       then I use current_env to go after a few tables that I need to to
> generate the Seq
>       (notice that I had to add the "." at the end)
> 
> I just thought I would include this info, in case you will need to move
your
> app from dev to test, and go after a different schema.
> 
> Has anyone developed a more elegant solution? I would like to avoid having
> so many files (2 files XX_OJB.props and XX_repository.xml, for each
> environment). This was the best I could come up with.
> 
> -John
> 
> 
>       
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 10, 2003 10:13 AM
> To: OJB Users List
> Subject: Re: Oracle Connection & Schema Question
> 
> 
> Try this 
> 
> <class-descriptor  class="com.ojb.SomeClass" 
> table="PROJECT_FOO.SOME_TABLE">
> ..
> 
> 
> 
> 
> 
> 
> 
> "Brown, Melonie S. - Contractor" <[EMAIL PROTECTED]>
> 10.07.2003 19:03
> Please respond to "OJB Users List"
>  
>         To:     "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>         cc: 
>         Subject:        Oracle Connection & Schema Question
> 
> 
> A directive was handed down by our dba's as follows. . . 
> 
> "There will be a schema called PROJECT_FOO which contains data, views,
> procedures, etc.
> There will be a userid called FOOUSER which will be used by the 
> application
> to do what needs to be doing on the database (read, write).
> In developing code all calls to the database should include the prefix of
> the schema i.e. PROJECT_FOO.myusertable, PROJECT_FOO.mytable, etc."
> 
> Our repository.xml looks like this:
> 
>       <jdbc-connection-descriptor
>                                  platform="Oracle"
>                                  jdbc-level="2.0"
>                                  driver="com.p6spy.engine.spy.P6SpyDriver"
>                                  protocol="jdbc"
>                                  subprotocol="Oracle"  
>  dbalias="thin:@999.999.99.999:8888:SERVER"
>                                  username="FOOUSER"
>                                  password="foopassword"
>                                  jcd-alias="default"
>                                  default-connection="true" 
>                                  batch-mode="false"
>         useAutoCommit="1"
>         ignoreAutoCommitExceptions="false" 
>    >
>    <sequence-manager 
>  
> className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
>     </sequence-manager> 
>    </jdbc-connection-descriptor> 
> 
> 
> With OJB, where would the schema be specified?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to