You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Quintin Beukes <qu...@last.za.net> on 2009/10/03 04:48:49 UTC
Persistence Unit Property Overrides
Hey,
In my persistence unit I have properties to customize the behaviour of
the JPA implementation, ie. hibernate.
Is there a way to override these properties programmatically?
I am thinking specifically of unit tests, where I want hibernate to
"drop-create" instead of just "create". I tried specifying it in my
datasource creation properties in the InitialContext environment
hashtable, but this doesn't seem to take "priority", and looks like it
is applied last. Or did I make a mistake somewhere?
Thanks,
Quintin Beukes
Re: Persistence Unit Property Overrides
Posted by Quintin Beukes <qu...@skywalk.co.za>.
That's perfect. thanks.
Quintin Beukes
On Sun, Oct 4, 2009 at 9:57 PM, Jean-Louis MONTEIRO
<je...@atosorigin.com> wrote:
>
> Hi Quintin,
>
> Yes, you can use InitialContext properties in unit tests to override
> properties.
> Just one tip, you must use the persistence unit name and not the datasource
> name.
>
> Have a look to
> http://openejb.apache.org/3.0/configuring-persistenceunits-in-tests.html
>
> Hope it helps.
> Jean-Louis
>
>
> Q Beukes wrote:
>>
>> Hey,
>>
>> In my persistence unit I have properties to customize the behaviour of
>> the JPA implementation, ie. hibernate.
>>
>> Is there a way to override these properties programmatically?
>>
>> I am thinking specifically of unit tests, where I want hibernate to
>> "drop-create" instead of just "create". I tried specifying it in my
>> datasource creation properties in the InitialContext environment
>> hashtable, but this doesn't seem to take "priority", and looks like it
>> is applied last. Or did I make a mistake somewhere?
>>
>> Thanks,
>> Quintin Beukes
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Persistence-Unit-Property-Overrides-tp25725276p25741554.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>
Re: Persistence Unit Property Overrides
Posted by Jean-Louis MONTEIRO <je...@atosorigin.com>.
Hi Quintin,
Yes, you can use InitialContext properties in unit tests to override
properties.
Just one tip, you must use the persistence unit name and not the datasource
name.
Have a look to
http://openejb.apache.org/3.0/configuring-persistenceunits-in-tests.html
Hope it helps.
Jean-Louis
Q Beukes wrote:
>
> Hey,
>
> In my persistence unit I have properties to customize the behaviour of
> the JPA implementation, ie. hibernate.
>
> Is there a way to override these properties programmatically?
>
> I am thinking specifically of unit tests, where I want hibernate to
> "drop-create" instead of just "create". I tried specifying it in my
> datasource creation properties in the InitialContext environment
> hashtable, but this doesn't seem to take "priority", and looks like it
> is applied last. Or did I make a mistake somewhere?
>
> Thanks,
> Quintin Beukes
>
>
--
View this message in context: http://www.nabble.com/Persistence-Unit-Property-Overrides-tp25725276p25741554.html
Sent from the OpenEJB User mailing list archive at Nabble.com.