Hi Andreas,
thank you for your response.
I tried this. If I run the Ant task example from the OpenJPA manual for
creating a schema (Schema Tool Ant Task) then the system tells me:
[schematool] The options supplied to the SchemaToolTask are not valid.
Please check your ant build file.
If I try to run the mapping tool against the database I receive the
following:
[reversemappingtool] <openjpa-1.0.2-r420667:627158 fatal user error>
org.apache.openjpa.util.UserException: A JDBC Driver or DataSource class
name must be specified in the ConnectionDriverName property.
Below is my ant task:
Any idea what is wrong?
Thank you, Lars
----
<?xml version="1.0"?>
<project name="docbook-src" default="reversemap">
<description>
This Ant build.xml file is used to transform DocBook XML to
various output formats
</description>
<target name="schema">
<!-- define the schematool task; this can be done at the top of -->
<!-- the build.xml file, so it will be available for all targets -->
<taskdef name="schematool" classname="
org.apache.openjpa.jdbc.ant.SchemaToolTask" />
<!-- add the schema components for all .schema files below the -->
<!-- current directory -->
<schematool action="add">
<fileset dir=".">
<include name="**/*.schema" />
</fileset>
</schematool>
</target>
<target name="reversemap">
<!-- define the reversemappingtool task; this can be done at the top
of -->
<!-- the build.xml file, so it will be available for all targets -->
<taskdef name="reversemappingtool" classname="
org.apache.openjpa.jdbc.ant.ReverseMappingToolTask" />
<!-- reverse map the entire database -->
<reversemappingtool package="datamodel" directory="${basedir}/src"
customizerProperties="${basedir}/conf/reverse.properties">
<codeformat tabSpaces="4" spaceBeforeParen="true"
braceOnSameLine="false" />
</reversemappingtool>
</target>
</project>
--------------
2008/3/30, os_developer <[EMAIL PROTECTED]>:
>
> I'm not sure if your orm.xml file is invalid or not
> but one of the ways I've found to get a start on a
> valid orm.xml file when I wasn't sure if mine was
> correct was to use the Reverse Mapping tool in openjpa
> (see the manual for more info).
>
> If you already have a working example using
> annotations, you can use the ant task to create your
> orm.xml file for you, based on what you already have
> in the database from your previous working example.
>
> I do know that my orm.xml files look very different
> from yours but I don't know where exactly the problem
> might be.
>
> Andrea
>
>
>
> --- Lars Vogel <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > Can anyone point me to a working standalone example
> > there a a orm.xml file
> > is used instead of Annotations?
> >
> > I'm able to build a small example with annotations
> > but if I try the same
> > with orm.xml I receive the following error:
> >
> > Exception in thread "main"
> > <openjpa-1.0.2-r420667:627158 fatal user error>
> > org.apache.openjpa.persistence.ArgumentException:
> > Could not locate metadata
> > for the class using alias
> > "MYAPPLICATION.PEOPLETABLE". This could mean that
> > the OpenJPA enhancer or load-time weaver was not run
> > on the type whose alias
> > is "MYAPPLICATION.PEOPLETABLE". Registered alias
> > mappings: "{
> > MYAPPLICATION.PEOPLETABLE=null, Person=[class
> > datamodel.Person]}"
> >
> >
> > I have the following orm.xml
> >
> > <entity-mappings
> > xmlns="http://java.sun.com/xml/ns/persistence/orm"
> >
> >
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >
> >
>
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/ormorm_1_0.xsd"
>
> > version="1.0">
> > <entity class="datamodel.Person">
> > <table name="MYAPPLICATION.PEOPLETABLE"/>
> > <attributes>
> > <id name="id" />
> > <basic name="firstName" />
> > <basic name="lastName" />
> > <transient name="nonsenseField" />
> > </attributes>
> > </entity>
> > </entity-mappings>
> >
> > I have the following persistence.xml
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!--
> > Licensed to the Apache Software Foundation (ASF)
> > under one
> > or more contributor license agreements. See the
> > NOTICE file
> > distributed with this work for additional
> > information
> > regarding copyright ownership. The ASF licenses
> > this file
> > to you under the Apache License, Version 2.0
> > (the
> > "License"); you may not use this file except in
> > compliance
> > with the License. You may obtain a copy of the
> > License at
> >
> > http://www.apache.org/licenses/LICENSE-2.0
> >
> > Unless required by applicable law or agreed to
> > in writing,
> > software distributed under the License is
> > distributed on an
> > "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
> > OF ANY
> > KIND, either express or implied. See the
> > License for the
> > specific language governing permissions and
> > limitations
> > under the License.
> > -->
> > <persistence
> > xmlns="http://java.sun.com/xml/ns/persistence"
> >
> >
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > version="1.0">
> >
> > <!--
> > A persistence unit is a set of listed
> > persistent entities as well
> > the configuration of an
> > EntityManagerFactory. We configure each
> > example in a separate persistence-unit.
> > -->
> > <persistence-unit name="people"
> > transaction-type="RESOURCE_LOCAL">
> >
> > <!--
> > The default provider can be OpenJPA, or
> > some other product.
> > This element is optional if OpenJPA is
> > the only JPA provider
> > in the current classloading environment,
> > but can be specified
> > in cases where there are multiple JPA
> > implementations available.
> > -->
> >
> > <provider>
> >
> >
> org.apache.openjpa.persistence.PersistenceProviderImpl
> > </provider>
> >
> > <mapping-file>META-INF/orm.xml</mapping-file>
> >
> > <!-- We must enumerate each entity in the
> > persistence unit -->
> > <class>datamodel.Person</class>
> >
> > <properties>
> > <property name="openjpa.ConnectionURL"
> >
> >
> value="jdbc:derby:C:/DerbyDatabases/hellojpa-database9;create=true"
> > />
> > <property
> > name="openjpa.ConnectionDriverName"
> >
> > value="org.apache.derby.jdbc.EmbeddedDriver" />
> > <property
> > name="openjpa.ConnectionUserName" value="" />
> > <property
> > name="openjpa.ConnectionPassword" value="" />
> >
> > <!--
> > Tell OpenJPA to automatically create
> > tables in the database
> > for entities. Note that this should
> > be disabled when
> > running against a production
> > database, since you probably
> > don't want to be altering the schema
> > at runtime.
> > -->
> > <property
> > name="openjpa.jdbc.SynchronizeMappings"
> > value="buildSchema" />
> >
> > </properties>
> > </persistence-unit>
> >
> > </persistence>
> >
> >
> > Best regards, Lars
> >
>
>
>
>
>
>
> ____________________________________________________________________________________
> Special deal for Yahoo! users & friends - No Cost. Get a month of
> Blockbuster Total Access now
> http://tc.deals.yahoo.com/tc/blockbuster/text3.com
>