You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Joshua Jackson <jo...@gmail.com> on 2007/05/11 08:13:35 UTC
How do we know the entity is successfully deployed on appserver
Dear all,
How do I know whether an entity is successfully deployed on an
appserver? Usually I detect this by autogenerating tables in database.
Is there anyway I can autogenerate tables in database with OpenJPA?
I've searched in documentation but perhaps I have missed it when
reading it.
Last but not least, am I allowed to ask user questions in this list?
Since this is a dev list.
Thanks in advance
--
YM!: thejavafreak
Blog: http://www.nagasakti.or.id/roller/joshua/
Re: How do we know the entity is successfully deployed on appserver
Posted by Marina Vatkina <Ma...@Sun.COM>.
One more clarification - the tables are created at deploy, only if there is some
kind of integration between the appserver and the persistence provider.
Unfortunately, there is no standard way for the appserver to detect a ddl
generation request made via persistence provider specific properties, or convert
a known request (made via appserver configuration) into a particular persistence
provider properties if such provider is not tightly integrated with the appserver.
More than that, the integration needs to include suppression of those properties
at runtime, so that the tables are not recreated on each server restart.
Regards,
-marina
Marina Vatkina wrote:
> The problem is - unless the user needs to create tables, there is no EM
> being created on deploy. Even on the load after deploy, the server might
> choose to do it lazily until the actual access from the user of a
> component that has an EM injection (or even later when the EM is looked
> up). If it's the EMF that is injected, then the server will not create
> an EM at all.
>
> Regards,
> -marina
>
> Patrick Linskey wrote:
>
>>> It's up to each app server to decide how you can check the deployment
>>> status.
>>
>>
>>
>> I think it'd be good, though, if OpenJPA had a setting or an API call
>> to ensure that everything was up and running once the factory was
>> created. Currently, that API call is:
>>
>> emf.createEntityManager().close();
>>
>> It'd be nice at least to provide either a declarative (setting)
>> approach for that, or an API that does just that but sounds a bit less
>> hacky. We could then potentially optimize the API at a later time.
>>
>> -Patrick
>>
>> On 5/22/07, Marina Vatkina <Ma...@sun.com> wrote:
>>
>>> Joshua,
>>>
>>> If you deploy an application into an appserver, and your persistence.xml
>>> contains the openjpa.jdbc.SynchronizeMappings property, the tables
>>> will be
>>> created on the 1st emf.createEntityManager() call (or injection of EM
>>> that does
>>> the same in the background), i.e. on every redeploy or server restart.
>>>
>>> It's up to each app server to decide how you can check the deployment
>>> status.
>>>
>>> Regards,
>>> -marina
>>>
>>> Kevin Sutter wrote:
>>> > Joshua,
>>> > Most definitely you can ask user questions on this list. Thanks for
>>> > posting.
>>> >
>>> > OpenJPA provides the ability to autogenerate the database tables at
>>> runtime
>>> > via the SynchronizeMappings property in the persistence.xml.
>>> Here's an
>>> > example usage:
>>> >
>>> > <persistence-unit name="inheritance">
>>> > <class>my.persistence.tests.inheritance.RootEntity</class>
>>> > <class>my.persistence.tests.inheritance.LeafEntity</class>
>>> > <class>my.persistence.tests.inheritance.AbstractEntity</class>
>>> > <properties>
>>> > <property name="openjpa.ConnectionDriverName"
>>> > value="org.apache.commons.dbcp.BasicDataSource"/>
>>> > <property name="openjpa.ConnectionProperties"
>>> >
>>> value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver
>>> >
>>> ,Url=jdbc:derby:target/temp/play/play.test;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
>>>
>>> >
>>> > <property name="openjpa.jdbc.SynchronizeMappings"
>>> > value="buildSchema(ForeignKeys=true)"/>
>>> > <property name="openjpa.Log" value="DefaultLevel=INFO"/>
>>> > </properties>
>>> > </persistence-unit>
>>> >
>>> >
>>> > On 5/11/07, Joshua Jackson <jo...@gmail.com> wrote:
>>> >
>>> >>
>>> >> Dear all,
>>> >>
>>> >> How do I know whether an entity is successfully deployed on an
>>> >> appserver? Usually I detect this by autogenerating tables in
>>> database.
>>> >> Is there anyway I can autogenerate tables in database with OpenJPA?
>>> >> I've searched in documentation but perhaps I have missed it when
>>> >> reading it.
>>> >>
>>> >> Last but not least, am I allowed to ask user questions in this list?
>>> >> Since this is a dev list.
>>> >>
>>> >> Thanks in advance
>>> >>
>>> >> --
>>> >> YM!: thejavafreak
>>> >> Blog: http://www.nagasakti.or.id/roller/joshua/
>>> >>
>>> >
>>>
>>>
>>
>>
>
Re: How do we know the entity is successfully deployed on appserver
Posted by Marina Vatkina <Ma...@Sun.COM>.
The problem is - unless the user needs to create tables, there is no EM being
created on deploy. Even on the load after deploy, the server might choose to do
it lazily until the actual access from the user of a component that has an EM
injection (or even later when the EM is looked up). If it's the EMF that is
injected, then the server will not create an EM at all.
Regards,
-marina
Patrick Linskey wrote:
>> It's up to each app server to decide how you can check the deployment
>> status.
>
>
> I think it'd be good, though, if OpenJPA had a setting or an API call
> to ensure that everything was up and running once the factory was
> created. Currently, that API call is:
>
> emf.createEntityManager().close();
>
> It'd be nice at least to provide either a declarative (setting)
> approach for that, or an API that does just that but sounds a bit less
> hacky. We could then potentially optimize the API at a later time.
>
> -Patrick
>
> On 5/22/07, Marina Vatkina <Ma...@sun.com> wrote:
>
>> Joshua,
>>
>> If you deploy an application into an appserver, and your persistence.xml
>> contains the openjpa.jdbc.SynchronizeMappings property, the tables
>> will be
>> created on the 1st emf.createEntityManager() call (or injection of EM
>> that does
>> the same in the background), i.e. on every redeploy or server restart.
>>
>> It's up to each app server to decide how you can check the deployment
>> status.
>>
>> Regards,
>> -marina
>>
>> Kevin Sutter wrote:
>> > Joshua,
>> > Most definitely you can ask user questions on this list. Thanks for
>> > posting.
>> >
>> > OpenJPA provides the ability to autogenerate the database tables at
>> runtime
>> > via the SynchronizeMappings property in the persistence.xml. Here's an
>> > example usage:
>> >
>> > <persistence-unit name="inheritance">
>> > <class>my.persistence.tests.inheritance.RootEntity</class>
>> > <class>my.persistence.tests.inheritance.LeafEntity</class>
>> > <class>my.persistence.tests.inheritance.AbstractEntity</class>
>> > <properties>
>> > <property name="openjpa.ConnectionDriverName"
>> > value="org.apache.commons.dbcp.BasicDataSource"/>
>> > <property name="openjpa.ConnectionProperties"
>> >
>> value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver
>> >
>> ,Url=jdbc:derby:target/temp/play/play.test;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
>>
>> >
>> > <property name="openjpa.jdbc.SynchronizeMappings"
>> > value="buildSchema(ForeignKeys=true)"/>
>> > <property name="openjpa.Log" value="DefaultLevel=INFO"/>
>> > </properties>
>> > </persistence-unit>
>> >
>> >
>> > On 5/11/07, Joshua Jackson <jo...@gmail.com> wrote:
>> >
>> >>
>> >> Dear all,
>> >>
>> >> How do I know whether an entity is successfully deployed on an
>> >> appserver? Usually I detect this by autogenerating tables in database.
>> >> Is there anyway I can autogenerate tables in database with OpenJPA?
>> >> I've searched in documentation but perhaps I have missed it when
>> >> reading it.
>> >>
>> >> Last but not least, am I allowed to ask user questions in this list?
>> >> Since this is a dev list.
>> >>
>> >> Thanks in advance
>> >>
>> >> --
>> >> YM!: thejavafreak
>> >> Blog: http://www.nagasakti.or.id/roller/joshua/
>> >>
>> >
>>
>>
>
>
Re: How do we know the entity is successfully deployed on appserver
Posted by Patrick Linskey <pl...@gmail.com>.
> It's up to each app server to decide how you can check the deployment status.
I think it'd be good, though, if OpenJPA had a setting or an API call
to ensure that everything was up and running once the factory was
created. Currently, that API call is:
emf.createEntityManager().close();
It'd be nice at least to provide either a declarative (setting)
approach for that, or an API that does just that but sounds a bit less
hacky. We could then potentially optimize the API at a later time.
-Patrick
On 5/22/07, Marina Vatkina <Ma...@sun.com> wrote:
> Joshua,
>
> If you deploy an application into an appserver, and your persistence.xml
> contains the openjpa.jdbc.SynchronizeMappings property, the tables will be
> created on the 1st emf.createEntityManager() call (or injection of EM that does
> the same in the background), i.e. on every redeploy or server restart.
>
> It's up to each app server to decide how you can check the deployment status.
>
> Regards,
> -marina
>
> Kevin Sutter wrote:
> > Joshua,
> > Most definitely you can ask user questions on this list. Thanks for
> > posting.
> >
> > OpenJPA provides the ability to autogenerate the database tables at runtime
> > via the SynchronizeMappings property in the persistence.xml. Here's an
> > example usage:
> >
> > <persistence-unit name="inheritance">
> > <class>my.persistence.tests.inheritance.RootEntity</class>
> > <class>my.persistence.tests.inheritance.LeafEntity</class>
> > <class>my.persistence.tests.inheritance.AbstractEntity</class>
> > <properties>
> > <property name="openjpa.ConnectionDriverName"
> > value="org.apache.commons.dbcp.BasicDataSource"/>
> > <property name="openjpa.ConnectionProperties"
> > value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver
> > ,Url=jdbc:derby:target/temp/play/play.test;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
> >
> > <property name="openjpa.jdbc.SynchronizeMappings"
> > value="buildSchema(ForeignKeys=true)"/>
> > <property name="openjpa.Log" value="DefaultLevel=INFO"/>
> > </properties>
> > </persistence-unit>
> >
> >
> > On 5/11/07, Joshua Jackson <jo...@gmail.com> wrote:
> >
> >>
> >> Dear all,
> >>
> >> How do I know whether an entity is successfully deployed on an
> >> appserver? Usually I detect this by autogenerating tables in database.
> >> Is there anyway I can autogenerate tables in database with OpenJPA?
> >> I've searched in documentation but perhaps I have missed it when
> >> reading it.
> >>
> >> Last but not least, am I allowed to ask user questions in this list?
> >> Since this is a dev list.
> >>
> >> Thanks in advance
> >>
> >> --
> >> YM!: thejavafreak
> >> Blog: http://www.nagasakti.or.id/roller/joshua/
> >>
> >
>
>
--
Patrick Linskey
202 669 5907
Re: How do we know the entity is successfully deployed on appserver
Posted by Marina Vatkina <Ma...@Sun.COM>.
Joshua,
If you deploy an application into an appserver, and your persistence.xml
contains the openjpa.jdbc.SynchronizeMappings property, the tables will be
created on the 1st emf.createEntityManager() call (or injection of EM that does
the same in the background), i.e. on every redeploy or server restart.
It's up to each app server to decide how you can check the deployment status.
Regards,
-marina
Kevin Sutter wrote:
> Joshua,
> Most definitely you can ask user questions on this list. Thanks for
> posting.
>
> OpenJPA provides the ability to autogenerate the database tables at runtime
> via the SynchronizeMappings property in the persistence.xml. Here's an
> example usage:
>
> <persistence-unit name="inheritance">
> <class>my.persistence.tests.inheritance.RootEntity</class>
> <class>my.persistence.tests.inheritance.LeafEntity</class>
> <class>my.persistence.tests.inheritance.AbstractEntity</class>
> <properties>
> <property name="openjpa.ConnectionDriverName"
> value="org.apache.commons.dbcp.BasicDataSource"/>
> <property name="openjpa.ConnectionProperties"
> value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver
> ,Url=jdbc:derby:target/temp/play/play.test;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
>
> <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)"/>
> <property name="openjpa.Log" value="DefaultLevel=INFO"/>
> </properties>
> </persistence-unit>
>
>
> On 5/11/07, Joshua Jackson <jo...@gmail.com> wrote:
>
>>
>> Dear all,
>>
>> How do I know whether an entity is successfully deployed on an
>> appserver? Usually I detect this by autogenerating tables in database.
>> Is there anyway I can autogenerate tables in database with OpenJPA?
>> I've searched in documentation but perhaps I have missed it when
>> reading it.
>>
>> Last but not least, am I allowed to ask user questions in this list?
>> Since this is a dev list.
>>
>> Thanks in advance
>>
>> --
>> YM!: thejavafreak
>> Blog: http://www.nagasakti.or.id/roller/joshua/
>>
>
Re: How do we know the entity is successfully deployed on appserver
Posted by Kevin Sutter <kw...@gmail.com>.
Joshua,
Most definitely you can ask user questions on this list. Thanks for
posting.
OpenJPA provides the ability to autogenerate the database tables at runtime
via the SynchronizeMappings property in the persistence.xml. Here's an
example usage:
<persistence-unit name="inheritance">
<class>my.persistence.tests.inheritance.RootEntity</class>
<class>my.persistence.tests.inheritance.LeafEntity</class>
<class>my.persistence.tests.inheritance.AbstractEntity</class>
<properties>
<property name="openjpa.ConnectionDriverName"
value="org.apache.commons.dbcp.BasicDataSource"/>
<property name="openjpa.ConnectionProperties"
value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver
,Url=jdbc:derby:target/temp/play/play.test;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
<property name="openjpa.Log" value="DefaultLevel=INFO"/>
</properties>
</persistence-unit>
On 5/11/07, Joshua Jackson <jo...@gmail.com> wrote:
>
> Dear all,
>
> How do I know whether an entity is successfully deployed on an
> appserver? Usually I detect this by autogenerating tables in database.
> Is there anyway I can autogenerate tables in database with OpenJPA?
> I've searched in documentation but perhaps I have missed it when
> reading it.
>
> Last but not least, am I allowed to ask user questions in this list?
> Since this is a dev list.
>
> Thanks in advance
>
> --
> YM!: thejavafreak
> Blog: http://www.nagasakti.or.id/roller/joshua/
>