You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Tom Mutdosch <to...@gmail.com> on 2007/08/28 14:51:19 UTC

best way to set default schema across all entities

Hi guys,

I asked this before but it got lost in the shuffle.  I am looking for 
the best way to set a default schema for all entities.  The scenario is 
a DB2 database using a different schema for testing and deploy time.  So 
I would want just one place that I could quickly change the schema when 
necessary.  I can successfully do this using an openjpa property in my 
persistence.xml:
<property name="openjpa.jdbc.Schema" value="ADMINISTRATOR"/>

But that doesn't seem as clean.  Should I be able to set the default 
schema in the orm.xml?  I have been unable to get that to work, and I'm 
not sure if it's because something is going wrong, or if it's not 
supported.  Does setting the default schema in the orm.xml only apply to 
entities that are also mapped in there?  Maybe the Java entities (with 
no schema set via an annotation) are somehow overriding the schema 
defined in the orm.xml.  What is the expected behavior here?

Thanks
Tom

Re: best way to set default schema across all entities

Posted by Patrick Linskey <pl...@gmail.com>.
> supported.  Does setting the default schema in the orm.xml only apply to
> entities that are also mapped in there?

Yes, I believe so. Imagine that you had multiple orm.xml files: which
schema definition would be the right default one?

> Maybe the Java entities (with
> no schema set via an annotation) are somehow overriding the schema
> defined in the orm.xml.  What is the expected behavior here?

I would expect that entities that do not specify a schema would go
into the default schema, based on the database credentials in the
absence of any OpenJPA-specific configuration.

-Patrick

On 8/28/07, Tom Mutdosch <to...@gmail.com> wrote:
> Hi guys,
>
> I asked this before but it got lost in the shuffle.  I am looking for
> the best way to set a default schema for all entities.  The scenario is
> a DB2 database using a different schema for testing and deploy time.  So
> I would want just one place that I could quickly change the schema when
> necessary.  I can successfully do this using an openjpa property in my
> persistence.xml:
> <property name="openjpa.jdbc.Schema" value="ADMINISTRATOR"/>
>
> But that doesn't seem as clean.  Should I be able to set the default
> schema in the orm.xml?  I have been unable to get that to work, and I'm
> not sure if it's because something is going wrong, or if it's not
> supported.  Does setting the default schema in the orm.xml only apply to
> entities that are also mapped in there?  Maybe the Java entities (with
> no schema set via an annotation) are somehow overriding the schema
> defined in the orm.xml.  What is the expected behavior here?
>
> Thanks
> Tom
>


-- 
Patrick Linskey
202 669 5907