openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miłosz Tylenda <mtyle...@o2.pl>
Subject Re: Database Schema Generation
Date Tue, 17 Feb 2009 13:44:48 GMT
Hi David,

My understanding of the JPA spec is that it does not address database schema generation. I
have found the following quote in both JPA 1 and JPA 2 Public Draft:

"It is permitted, but not required, that DDL generation be supported by an implementation
of this specification.
Portable applications should not rely upon the use of DDL generation."

So, i would say that the schema tool is an OpenJPA's extension to JPA and the lack of "CREATE
SCHEMA" functionality is a limitation in the tool.

Regards,
Milosz


> 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 
> 
> > 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.<persistence-unit name="Veilig-Dev-PU"
> > transaction-type="RESOURCE_LOCAL">
> >
> >  <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> >  <class>veilig.entry.AdditionalInformation</class>
> >  <class>veilig.application.Application</class>
> >  <class>veilig.entry.Entry</class>
> >  <properties>
> >  <property name="openjpa.ConnectionPassword" value="app"/>
> >  <property name="openjpa.ConnectionDriverName"
> > value="org.h2.Driver"/>
> >  <property name="openjpa.ConnectionUserName" value="app"/>
> >  <property name="openjpa.ConnectionURL"
> > value="jdbc:h2:./data/veilig"/>
> >  <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO,
> > Tool=INFO, SQL=TRACE"/>
> >  <!--<property name="openjpa.jdbc.SynchronizeMappings"
> > value="buildSchema(ForeignKeys=true)"/>-->
> >  <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"
> > />
> >  <property name="openjpa.jdbc.Schema" value="Veilig"/>
> >  <property name="openjpa.jdbc.DBDictionary"
> > value="org.apache.openjpa.jdbc.sql.H2Dictionary(useGetObjectForBlobs=false)"/>
> >  </properties>
> >  </persistence-unit>
> > Thanks for your help much apreciated.
> > 2009/2/13 Judes Tumuhairwe <judethecutedude@gmail.com
> > >
> > Hi David,
> > What Martin suggested is right. Just add that *property* element to your
> > persistence-unit in your persistence.xml.
> > <properties>
> > <property name="openjpa.jdbc.SynchronizeMappings"
> > value="buildSchema(SchemaAction=add,deleteTableContents,ForeignKeys=true)"
> > />
> > </properties>
> > 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' & 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 
> > >wrote:
> > > Hi All
> > >
> > > Can anyone help with this. Is it possible this just doesn't work with
> > the
> > > h2
> > > database or should my persistence.xml file be in a specific order. As
> > in
> > > have the values and properties got to be in a specific order? Is it
> > worth
> > > upgrading to a newer version of openjpa, would this solve my issue?
> > >
> > > David
> > >
> > > 2009/2/10 David Beer <david.m.beer@googlemail.com
> > >
> > >
> > > > Hi Martin
> > > >
> > > > Thanks for your suggestion, I have tried entering the value but
> > it
> > > doesn't
> > > > seem to work. Where did you find the documentation values for
> > > > jdbc.SynchroniseMappings
> > > >
> > > > David
> > > >
> > > > 2009/2/9 Martin Uhlir <stoupa91devel@seznam.cz
> > >
> > > >
> > > >> Hi,
> > > >>
> > > >> put this property into properties list in the persistence.xml
> > > >>
> > > >> <property name="openjpa.jdbc.SynchronizeMappings"
> > > >> value="buildSchema(SchemaAction='add')"/>
> > > >>
> > > >> Martin
> > > >>
> > > >>
> > > >>
> > > >> David Beer wrote:
> > > >>
> > > >>> Hi All
> > > >>>
> > > >>> I have successsfully set the Schema in the
> > persistence.xml file. My
> > > >>> question
> > > >>> is how do I get the schma auto generated when the table
> > are generated.
> > > I
> > > >>> am
> > > >>> using the h2 database.
> > > >>>
> > > >>> Any guidence would helpful.
> > > >>>
> > > >>> Thanks
> > > >>>
> > > >>> David
> > > >>>
> > > >>>
> > > >>>
> > > >>
> > > >>
> > > >
> > >
> >
> 

Mime
View raw message