Hi! My colleague introduced a ConfigurableDataSource for exactly this reason. It switches all the database configuration based on server and JSF ProjectStage settings based on CDI producers.
LieGrue, strub --- On Mon, 1/10/11, Michael Dick <michael.d.d...@gmail.com> wrote: > From: Michael Dick <michael.d.d...@gmail.com> > Subject: Re: change schema based on environment > To: dev@openjpa.apache.org > Date: Monday, January 10, 2011, 4:55 PM > AFAIK WebSphere doesn't give you > direct access to the connection URL. But > there is a custom property for currentSchema that should > work. > > hth > -mike > > On Sat, Jan 8, 2011 at 10:59 AM, Miłosz Tylenda <mtyle...@o2.pl> > wrote: > > > Keith, > > > > You can specify a default schema in a DB2 connection > URL like this: > > > > > jdbc:db2://mserver:50007/MYDB7T:currentSchema=MySchema; > > > > Can you use this syntax when creating the data > source? > > > > Regards, > > Milosz > > > > > > > > I am using OpenJPA 1.2.3 on WebSphere with DB2. > > > > > > I have spent a lot of time trying to figure out > if there is a way to > > build > > > and bundle my application in a way that allows > for the same application > > > (EAR) to have a changing Schema name based on > environment (DEV,ACPT,PROD, > > > etc). > > > > > > My PU is setup up to be container managed as > follows: > > > > > > <persistence> > > > > <persistence-unit name="My_PU" > transaction-type="JTA"> > > > > <jta-data-source>jdbc/DataSource</jta-data-source> > > > > ... > > > > <properties> > > > > <property > name="openjpa.jdbc.Schema" > > value="MYSCHEMA"/> > > > > <property > name="openjpa.TransactionMode" > > value="managed"/> > > > > <property > name="openjpa.ConnectionFactoryMode" > > value="managed"/> > > > > </properties> > > > > </persistence-unit> > > > </persistence> > > > > > > I have looked into putting this in the ORM.xml, > but this is still a > > static > > > value for the schema, and does not externalize > the setting; also, it > > doesn't > > > seem to work (I have seen the many threads > discussing this). I also, have > > > looked into putting this configuration into the > WebSphere data source; > > this > > > does not seem to work either. > > > > > > Any help is appreciated. Thanks. > > > > > > --Keith > > > > > >