persistence@glassfish.java.net

Re: how to configure different orm.xml files again

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Wed, 09 Jan 2008 10:17:16 -0500

Hello Johannes,
     Are the table/column names changing with each deployment or just
the schema name? If it is just the schema name you could register a
Session Customizer and within that customizer call
.setTableQualifier(String) on the Session's login
(session.getLogin().setTableQualifier(String) ) This will cause TopLink
to qualify all of the table references with a particular String. You
would not set any schema names within the orm.xml files.
--Gordon

Johannes Hoehne wrote:
>
> Yes indeed I did. But this is a very redundant way because nearly
> every thing is identical but the schema name in the server specific
> orm.xml file.
>
> Johannes Höhne
> P *Please consider the environmental impact of needlessly printing
> this e-mail.*
>
>
>
> *Gordon Yorke <gordon.yorke_at_oracle.com>*
>
> 08.01.2008 15:27
> Please respond to
> persistence_at_glassfish.dev.java.net
>
>
>
> To
> persistence_at_glassfish.dev.java.net
> cc
>
> Subject
> Re: how to configure different orm.xml files again
>
>
>
>
>
>
>
>
>
> Have you considered configuring multiple Persistence Units and using
> the system property to choose a Persistent Unit instead of
> configuration file?
> -Gordon
>
> Johannes Hoehne wrote:
>
> Hi
>
> > Basically
> > what I suggest is to build different ear files for the different
> database
> > schema's. I'm sure you looked into this and discarded this option.
>
> This is the way we did it before. But than we implemented a mechanism
> which is able to use the right configuration file (for the server) out
> of a bundle. I think this is a good thing because you deploy exactly
> that EAR on prod which you tested before. I don't think that my boss
> will put aside this strategy.
>
> Johannes Hoehne
>
> Hi,
>
> On Tue, Jan 08, 2008 at 09:32:54AM +0100, Johannes Hoehne wrote:
> > We use the same EAR file for different EJB servers. Each server uses a
> > different data base schema. As it is no problem to use different
> databases with
> > no extra configuration (different targets of the JNDI name) it is
> not possible
> > to use different schemes. At the moment we tell the server by system
> property
> > the name of the configuration file of our (old fashion) persistence
> framework.
> > So we can deploy all the different configuration files within one EAR.
> > So far so good but we want to use JPA now. Is there any possibility
> to redirect
> > the file name of the orm.xml. Maybe be an (JNDI) property in the
> ebj-jar.xml?
> >
> > Last time I got the answer to inspect the tutorials and examples Of
> course I
> > did this before I wrote this mail. I wasn't able to find a solution
> of my
> > problem. So please help:)
>
> A while back I looked into JBoss Seam and they have a few examples
> that can be
> deployed on different app servers. The reason I bring this up is that
> they had
> an elegant way to include config files for the different app servers
> in their
> ear files. Basically they included an ant script that builds different
> ear files
> for different app servers including the config files for the specific
> app server
> they are building the ear for. Not sure if that is an option for you.
> Basically
> what I suggest is to build different ear files for the different database
> schema's. I'm sure you looked into this and discarded this option. But
> I thought
> I'd bring it up anyway :-)
>
>
> HTH, Wouter van Reeven
>
> --
>
> People: "If she weighs the same as a Duck, she's made of wood!"
> Sir Bedevere: "And therefore...?"
> ------------------------------------------------------------------------
> *RSC Commercial Services OHG*
> Wanheimer Straße 70, D-40468 Düsseldorf
> Registergericht: Düsseldorf, HRA 12655
>
> ------------------------------------------------------------------------
> *RSC Commercial Services OHG*
> Wanheimer Straße 70, D-40468 Düsseldorf
> Registergericht: Düsseldorf, HRA 12655