openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu wang <wangy...@gmail.com>
Subject Re: about variable DB schema name support
Date Mon, 30 Jan 2012 07:29:25 GMT
mike,
Thank you for your prompt response.

I must said even though I don't quite understand what are EMF and IIRC
stand for in your context, from my understanding, the key point of
your solution is leaving the schema property empty in the bean define
file like:
@Table(name = "MYBEAN", schema = "")

Then we can figure out a way to inject the schema name into
persistence.xml file and let user decide it in the deployment time.

Is my understanding correct?

Best Regards,
Yu Wang


On Sun, Jan 22, 2012 at 12:57 AM, Michael Dick <michael.d.dick@gmail.com> wrote:
> Quick answer, you can use the openjpa.jdbc.Schema property at EMF creation
> time. IIRC this won't work with EMF injection though.
>
> A kludgy way to go would be to not define a schema in p.xml or in the
> entities and let it pick up the default schema from your datasource. If you
> can use a resource reference in persistence.xml then you can map the
> resource reference to different datasources at deploy time.
>
> You'd have to set a custom property on the datasource (or use different
> logins) to get different schemas - but it should work.
>
> Otherwise I think there'd have to be some additional hooks in the app
> server at deploy time.
>
> hth
> -mike
>
> On Thu, Jan 19, 2012 at 12:25 AM, yu wang <wangyumi@gmail.com> wrote:
>
>> Hello gurus,
>> When I were developing J2EE APP with OpenJPA, the db schema name is
>> hard-coded into the annotation of Bean files and persistence.xml
>> file,
>> which incurs user cannot configure their DB schema name for the apps.
>>
>> Are there any chances we can let users determine their DB schema name
>> when they deploy the J2ee app employing OpenJPA?
>>
>> Best Regards,
>> Yu Wang
>>

Mime
View raw message