Hello, cool script. I modified it a little bit so that it runs for me....
Thanks to your script I'm now able to create a working example. I believe I confused @Table(name="MYAPPLICATION.PEOPLETABLE") with @Entity(name=" MYAPPLICATION.PEOPLETABLE") in my annotation example and this let me to incorrect orm.xml coding. Thank you very much. Best regards, Lars 2008/3/31, os_developer <[EMAIL PROTECTED]>: > > Lars, > > In your ant build script, I don't see where you are > specifying against which database the reverse mapping > tool should run. You need to provide your username and > password as well. > > In my setup, I have an initial database already up and > running. In my build directory, I have a build.xml > file and then a META-INF/persistence.xml file. > > When I run "ant reversemap" of my build.xml file, it > generates an orm.xml file and all of my java source. > > You will have to update my files with your database > info but here they are in case they might be of help. > I did have to modify the orm.xml file a bit after it > was created so it was exactly how I wanted, but it did > work as-is without my changes. > > Here's my persistence.xml file (and below is my > build.xml file): > > <?xml version="1.0"?> > > > <persistence > xmlns="http://java.sun.com/xml/ns/persistence" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence > > > > http://java.sun.com/xml/ns/persistence/persistence_1.0.xsd" > version="1.0"> > > <persistence-unit name="test" > transaction-type="RESOURCE_LOCAL"> > > > <provider> > > org.apache.openjpa.persistence.PersistenceProviderImpl > </provider> > > > </persistence-unit> > > </persistence> > > > > Here's my build.xml (I've cut out some pieces which > aren't relevant). > > > build.xml > > --------- > > <?xml version="1.0" encoding="UTF-8"?> > > <project default="reversemap" name="test" basedir="."> > > > <property environment="env"/> > > <condition property="bea.home" > value="${env.BEA_HOME}"> > <isset property="env.BEA_HOME"/> > </condition> > <fail unless="env.BEA_HOME" message="The BEA_HOME > property must be set"/> > > <condition property="package.name" > value="${env.PACKAGE_NAME}"> > <isset property="env.PACKAGE_NAME"/> > </condition> > <fail unless="env.PACKAGE_NAME" message="The > PACKAGE_NAME property must be set"/> > > > <property name="dbdriver" > value="oracle.jdbc.OracleDriver"/> > <property name="dburl" > value="jdbc:oracle:[EMAIL PROTECTED]:1521:mysid"/> > <property name="dbuser" value="myusername"/> > <property name="dbpass" value="mypassword"/> > > <path id="classpath"> > <pathelement path="${basedir}" /> > <pathelement path="${basedir}/META-INF" /> > <fileset dir="${bea.home}/modules"> > <include name="javax.persistence_*.jar"/> > <include name="org.apache.openjpa_*.jar"/> > <include > name="com.bea.core.apache.commons.lang_*.jar"/> > <include name="javax.transaction_*.jar"/> > <include name="javax.resource_*.jar"/> > <include name="com.bea.core.serp_*.jar"/> > </fileset> > <fileset dir="${bea.home}/modules"> > <include name="com.bea.oracle.ojdbc14_*.jar"/> > </fileset> > </path> > > <path id="classpath.oracle"> > <fileset dir="${bea.home}/modules"> > <include name="com.bea.oracle.ojdbc14_*.jar"/> > </fileset> > </path> > > <!-- =========================================== --> > <!-- Runs against the database to create an orm.xml > file and java classes --> > <!-- =========================================== --> > <target name="reversemap"> > > <!-- Removes any previously generated orm.xml --> > <delete> > <fileset dir="${basedir}"> > <include name="orm.xml" /> > </fileset> > </delete> > > <taskdef name="reversemappingtool" > classpathref="classpath" > > > > classname="org.apache.openjpa.jdbc.ant.ReverseMappingToolTask"/> > > > > <reversemappingtool > package="${package.name}" > directory="${basedir}/build"> > > <!-- This must be set to your database --> > <config > connectiondrivername="${dbdriver}" > connectionurl="${dburl}" > connectionusername="${dbuser}" > connectionpassword="${dbpass}" > propertiesfile="META-INF/persistence.xml"/> > > <classpath> > <pathelement path="${classpath}"/> > <pathelement path="${basedir}"/> > <pathelement path="${basedir}/META-INF"/> > <pathelement path="${classpath.oracle}/> > </classpath> > > > <codeformat tabSpaces="4" spaceBeforeParen="true" > > braceOnSameLine="false"/> > > </reversemappingtool> > > > <!-- This copies the persistence.xml and orm.xml > into > the directory where the java classes were > generated --> > > <mkdir dir="${basedir}/build"/> > <copy todir="${basedir}/build/META-INF"> > <fileset dir="${basedir}"> > <include name="orm.xml"/> > </fileset> > <fileset dir="${basedir}/META-INF"> > <include name="persistence.xml"/> > </fileset> > </copy> > > > </target> > > </project> > > > > > > > ____________________________________________________________________________________ > 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 >
