users@glassfish.java.net

Re: Specifying datasource during deployment of a JPA based application

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 01 Jun 2009 10:54:06 -0700

The spec says it's possible: "Provider or data source information
not specified in the persistence.xml file must be provided at deployment time or
defaulted by the container".

While the spec doesn't mention replacement support, GF only knows how to default
the datasource and the provider, if either is not specified.

Regards,
-marina

Sahoo wrote:
> No, AFAIK, there is no solution to your problem. As per JPA spec,
> GlassFish reads the DataSource value from persistence.xml. Obviously the
> JPA spec authors didn't think of your use case while writing the spec.
> But, I do agree you have a genuine issue.
>
> Thanks,
> Sahoo
>
> glassfish_at_javadesktop.org wrote:
>
>> I am looking for a clean way to specify the name of a datasource
>> during deployment of an EAR or WAR to glassfish 2.1.
>>
>> Using JPA the 'persistence.xml' file could have an entry for jta and
>> non-jta datasource names, along with other specifications (like the
>> class names for entities etc.). But what I [b]don't [/b] want is to
>> un-jar and re-jar my application package, manually editing the
>> persistence.xml file each time I deploy another instance (client's
>> copy) of the application. A clean separation of concerns (or
>> responsibilities/ roles) should leave the application untouched,
>> adding only additional environment information to the deployment plan.
>>
>> Is there any place where the datasource name can be put outside of the
>> WAR or EAR file and from where glassfish would map it to persistence
>> unit contained in the application?
>> [Message sent by forum member 'frankwhofmann' (frankwhofmann)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=348565
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>