Hi Judes
Thanks 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 <[email protected]>
> 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 <[email protected]
> >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 <[email protected]>
> >
> > > 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 <[email protected]>
> > >
> > >> 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
> > >>>
> > >>>
> > >>>
> > >>
> > >>
> > >
> >
>
Schema VEILIG not found; SQL statement:
CREATE TABLE Veilig.AdditionalInformation (id INTEGER NOT NULL IDENTITY, name
VARCHAR(255), val BLOB) [90079-67] {stmnt 1418303441 CREATE TABLE
Veilig.AdditionalInformation (id INTEGER NOT NULL IDENTITY, name VARCHAR(255),
val BLOB)} [code=90079, state=90079]
<openjpa-1.0.1-r420667:592145 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: Schema VEILIG not found;
SQL statement:
CREATE TABLE Veilig.AdditionalInformation (id INTEGER NOT NULL IDENTITY, name
VARCHAR(255), val BLOB) [90079-67] {stmnt 1418303441 CREATE TABLE
Veilig.AdditionalInformation (id INTEGER NOT NULL IDENTITY, name VARCHAR(255),
val BLOB)} [code=90079, state=90079]
at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:549)
at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:449)
at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:170)
at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:130)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:186)
at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
at veilig.util.db.DatabaseConnection.startup(DatabaseConnection.java:69)
at
veilig.util.db.DatabaseConnectionTest.testStartup(DatabaseConnectionTest.java:46)
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Schema VEILIG not
found; SQL statement:
CREATE TABLE Veilig.AdditionalInformation (id INTEGER NOT NULL IDENTITY, name
VARCHAR(255), val BLOB) [90079-67] {stmnt 1418303441 CREATE TABLE
Veilig.AdditionalInformation (id INTEGER NOT NULL IDENTITY, name VARCHAR(255),
val BLOB)} [code=90079, state=90079]
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(LoggingConnectionDecorator.java:57)
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:754)
at
org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
at
org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1185)
at
org.apache.openjpa.jdbc.schema.SchemaTool.createTable(SchemaTool.java:949)
at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:526)
at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:497)