You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by kumm0307 <ku...@gmail.com> on 2013/06/03 22:02:59 UTC

jpa extra-lazy initialization

Hello!

i've realized initialization of jpa provider is not a part of the deploy
process in tomEE (unlike glassfish, or jobss). 
Openjpa creates database schema at the first entitymanager call.
I can reproduce this in a simple web-application too, but my main issue is
integration testing.

I try to populate the database with test data before the test method. 
For example in arquillian i can do it at @before, but at this point the
schema does not exist. 
Tried arquillian-persistence, and failed too.

Is a switch somewhere to turn off this extra-lazy behaviour?



--
View this message in context: http://openejb.979440.n4.nabble.com/jpa-extra-lazy-initialization-tp4663443.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: jpa extra-lazy initialization

Posted by Tamás Kimmel <ku...@gmail.com>.
Thank you!
The openejb.jpa.init-entitymanager option is what i was looking for.

<property name="openejb.jpa.init-entitymanager" value="true" />

In persistence.xml solved my problem.


On Mon, Jun 3, 2013 at 10:08 PM, Romain Manni-Bucau
<rm...@gmail.com>wrote:

> Hi,
>
> this is an openjpa feature.
>
> In OpenEJB we have https://issues.apache.org/jira/browse/OPENEJB-1878
>
> + to init a database (mem) from sql script you can simply create a script
> (sql) at classpath called import-<name of datasource or persistence
> unit>.sql with a sql command by line and it will be executed at startup.
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/6/3 kumm0307 <ku...@gmail.com>
>
> > Hello!
> >
> > i've realized initialization of jpa provider is not a part of the deploy
> > process in tomEE (unlike glassfish, or jobss).
> > Openjpa creates database schema at the first entitymanager call.
> > I can reproduce this in a simple web-application too, but my main issue
> is
> > integration testing.
> >
> > I try to populate the database with test data before the test method.
> > For example in arquillian i can do it at @before, but at this point the
> > schema does not exist.
> > Tried arquillian-persistence, and failed too.
> >
> > Is a switch somewhere to turn off this extra-lazy behaviour?
> >
> >
> >
> > --
> > View this message in context:
> >
> http://openejb.979440.n4.nabble.com/jpa-extra-lazy-initialization-tp4663443.html
> > Sent from the OpenEJB User mailing list archive at Nabble.com.
> >
>

Re: jpa extra-lazy initialization

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

this is an openjpa feature.

In OpenEJB we have https://issues.apache.org/jira/browse/OPENEJB-1878

+ to init a database (mem) from sql script you can simply create a script
(sql) at classpath called import-<name of datasource or persistence
unit>.sql with a sql command by line and it will be executed at startup.

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/6/3 kumm0307 <ku...@gmail.com>

> Hello!
>
> i've realized initialization of jpa provider is not a part of the deploy
> process in tomEE (unlike glassfish, or jobss).
> Openjpa creates database schema at the first entitymanager call.
> I can reproduce this in a simple web-application too, but my main issue is
> integration testing.
>
> I try to populate the database with test data before the test method.
> For example in arquillian i can do it at @before, but at this point the
> schema does not exist.
> Tried arquillian-persistence, and failed too.
>
> Is a switch somewhere to turn off this extra-lazy behaviour?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/jpa-extra-lazy-initialization-tp4663443.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>