openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Beer <david.m.b...@googlemail.com>
Subject Re: Database Schema Generation
Date Mon, 16 Feb 2009 16:49:51 GMT
Hi Milosz

Thanks for the reply. that is quite annoying. Is this a limitation in the
openjpa  tool or in JPA? I am just curious as this would speed things up a
little when testing.

David

2009/2/15 MiƂosz Tylenda <mtylenda@o2.pl>

> David,
> I am afraid that the schema tool will not create the necessary schemas and
> you have to do it manually. I had a similar problem with PostgreSQL. This is
> a quote from the manual:
> "The schema tool manipulates tables, columns, indexes, constraints, and
> sequences. It cannot create or drop the database schema objects in which the
> tables reside, however. If your XML documents refer to named database
> schemas, those schemas must exist."
> The only case I am aware of where your example will work is when you use
> DB2 or Derby - these databases create schemas implicitly when CREATE TABLE
> refers to them.
> Greetings,
> Milosz
> Hi JudesThanks for the link. I thought I had specified the version in my
> first e-mail, but here it is I am using openjpa 1.0.1. I have attached both
> the stack trace and have pasted a snipit of my persistence.xml
> file.&lt;persistence-unit name="Veilig-Dev-PU"
> transaction-type="RESOURCE_LOCAL"&gt;
>
>  &lt;provider&gt;org.apache.openjpa.persistence.PersistenceProviderImpl&lt;/provider&gt;
>  &lt;class&gt;veilig.entry.AdditionalInformation&lt;/class&gt;
>  &lt;class&gt;veilig.application.Application&lt;/class&gt;
>  &lt;class&gt;veilig.entry.Entry&lt;/class&gt;
>  &lt;properties&gt;
>  &lt;property name="openjpa.ConnectionPassword" value="app"/&gt;
>  &lt;property name="openjpa.ConnectionDriverName"
> value="org.h2.Driver"/&gt;
>  &lt;property name="openjpa.ConnectionUserName" value="app"/&gt;
>  &lt;property name="openjpa.ConnectionURL"
> value="jdbc:h2:./data/veilig"/&gt;
>  &lt;property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO,
> Tool=INFO, SQL=TRACE"/&gt;
>  &lt;!--&lt;property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)"/&gt;--&gt;
>  &lt;property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"
> /&gt;
>  &lt;property name="openjpa.jdbc.Schema" value="Veilig"/&gt;
>  &lt;property name="openjpa.jdbc.DBDictionary"
> value="org.apache.openjpa.jdbc.sql.H2Dictionary(useGetObjectForBlobs=false)"/&gt;
>  &lt;/properties&gt;
>  &lt;/persistence-unit&gt;
> Thanks for your help much apreciated.
> 2009/2/13 Judes Tumuhairwe &lt;judethecutedude@gmail.com<lt%3Bjudethecutedude@gmail.com>
> &gt;
> Hi David,
> What Martin suggested is right. Just add that *property* element to your
> persistence-unit in your persistence.xml.
> &lt;properties&gt;
> &lt;property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(SchemaAction=add,deleteTableContents,ForeignKeys=true)"
> /&gt;
> &lt;/properties&gt;
> No, the properties don't have to appear is a specific order. It's not easy
> to help you when all we have is "it doesn't seem to work". What version of
> openJPA are you running, is there a stacktrace, a sample of your
> persistence.xml, anything at all. Perhaps it is an integration issue.
> I don't know where the documentation is either but I just googled 'openjpa
> persistence.xml' &amp; got a complete example of OpenJPA with H2
> configuration
> here [1]
> Does anyone on else know the possible values [chapter 2 (Configuration) of
> the manual on the website had the properties but doesn't have their
> possible/legal values]
> [1] http://www.jpox.org/servlet/forum/viewthread?thread=4188
> regards,
> Judes
> On Thu, Feb 12, 2009 at 2:20 PM, David Beer &
> lt;david.m.beer@googlemail.com <lt%3Bdavid.m.beer@googlemail.com>
> &gt;wrote:
> &gt; Hi All
> &gt;
> &gt; Can anyone help with this. Is it possible this just doesn't work with
> the
> &gt; h2
> &gt; database or should my persistence.xml file be in a specific order. As
> in
> &gt; have the values and properties got to be in a specific order? Is it
> worth
> &gt; upgrading to a newer version of openjpa, would this solve my issue?
> &gt;
> &gt; David
> &gt;
> &gt; 2009/2/10 David Beer &lt;david.m.beer@googlemail.com<lt%3Bdavid.m.beer@googlemail.com>
> &gt;
> &gt;
> &gt; &gt; Hi Martin
> &gt; &gt;
> &gt; &gt; Thanks for your suggestion, I have tried entering the value but
> it
> &gt; doesn't
> &gt; &gt; seem to work. Where did you find the documentation values for
> &gt; &gt; jdbc.SynchroniseMappings
> &gt; &gt;
> &gt; &gt; David
> &gt; &gt;
> &gt; &gt; 2009/2/9 Martin Uhlir &lt;stoupa91devel@seznam.cz<lt%3Bstoupa91devel@seznam.cz>
> &gt;
> &gt; &gt;
> &gt; &gt;&gt; Hi,
> &gt; &gt;&gt;
> &gt; &gt;&gt; put this property into properties list in the persistence.xml
> &gt; &gt;&gt;
> &gt; &gt;&gt; &lt;property name="openjpa.jdbc.SynchronizeMappings"
> &gt; &gt;&gt; value="buildSchema(SchemaAction='add')"/&gt;
> &gt; &gt;&gt;
> &gt; &gt;&gt; Martin
> &gt; &gt;&gt;
> &gt; &gt;&gt;
> &gt; &gt;&gt;
> &gt; &gt;&gt; David Beer wrote:
> &gt; &gt;&gt;
> &gt; &gt;&gt;&gt; Hi All
> &gt; &gt;&gt;&gt;
> &gt; &gt;&gt;&gt; I have successsfully set the Schema in the
> persistence.xml file. My
> &gt; &gt;&gt;&gt; question
> &gt; &gt;&gt;&gt; is how do I get the schma auto generated when the table
> are generated.
> &gt; I
> &gt; &gt;&gt;&gt; am
> &gt; &gt;&gt;&gt; using the h2 database.
> &gt; &gt;&gt;&gt;
> &gt; &gt;&gt;&gt; Any guidence would helpful.
> &gt; &gt;&gt;&gt;
> &gt; &gt;&gt;&gt; Thanks
> &gt; &gt;&gt;&gt;
> &gt; &gt;&gt;&gt; David
> &gt; &gt;&gt;&gt;
> &gt; &gt;&gt;&gt;
> &gt; &gt;&gt;&gt;
> &gt; &gt;&gt;
> &gt; &gt;&gt;
> &gt; &gt;
> &gt;
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message