openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marina Vatkina <Marina.Vatk...@Sun.COM>
Subject Re: How do we know the entity is successfully deployed on appserver
Date Wed, 23 May 2007 00:27:34 GMT
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 <Marina.Vatkina@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 <joshua.java@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/
>> >>
>> >
>>
>>
> 
> 


Mime
View raw message