On Monday 16 February 2009, David Goodenough wrote:
> I am trying to turn a bunch of SQL tables into Java classes for use with
> OpenJPA.
>
> I am using ant to do this, and I have coded my build.xml:-
>
> <path id="jpa">
> <fileset dir="lib">
> <include name="*.jar"/>
> </fileset>
> </path>
> <taskdef name="reversemappingtool"
>
> classname="org.apache.openjpa.jdbc.ant.ReverseMappingToolTask"
> classpathref="jpa"/>
> <!-- reverse map the entire database -->
> <reversemappingtool package="uk.co.linkchoose.accounts.jpa"
> directory="${basedir}/src"
> metadata="none">
> <config connectionDriverName="org.postgresql.Driver"
>
> connectionURL="jdbc:postgresql://10.0.1.2/linkchoose_accounts"
> connectionUserName="david"/>
> <codeformat tabSpaces="4"
> spaceBeforeParen="true"
> braceOnSameLine="true"/>
> </reversemappingtool>
>
> but when I run it is complains of a MetaDataException, saying that that
> the MetaDataFactory could not be configured and suggesting that I need
> a persistence.xml in my classpath.
>
> This makes no sense, as normally when I use persistence.xml the only
> things there are the provider (well I presume that the reverse mapping
> tool can only handle OpenJPA and is not generic, so that should not be
> needed), the list of persistent classes (these classes are going to be
> generated by the tool, so I should not have to list them in advance)
> and properties such as datasource or jdbc parms (I put the JDBC
> parms in the <config> tag.
>
> The documentation makes no reference to needing persistence.xml
> for the ReverseMappingTool that I can find.
>
> So why does it need a persistence.xml, and what needs to be in it.
>
> I am using 1.2.0-r422266:683325 if that makes a difference.
>
> David
Does no one else use the ReverseMappingTool. Its a real shame that it is
so difficult to use.
David