Hi,
Task:
Part1: having sql schema, generate mapping files and classes with xdoclet.
Part2: add a prefix _AAA and suffix _BBB to each generated class i java files
Part3: make the full constructor didn't appear
Part4: add implement word after each class name
I've found some examples, downloaded middlegen and now i have generated some hbms.xml files and .java files.
I use Ant. The problem is with Parts2-4.
Let me show u my ant script: I RUN: ANT CODEGEN
Code:
<target
name="middlegen"
description="Run Middlegen"
unless="middlegen.skip"
depends="init,fail-if-no-xdoclet-1.2,check-driver-present,panic-if-driver-not-present"
>
<mkdir dir="${build.gen-src.dir}"/>
<taskdef
name="middlegen"
classname="middlegen.MiddlegenTask"
classpathref="lib.class.path"
/>
<middlegen
appname="${name}"
prefsdir="${src.dir}"
gui="${gui}"
databaseurl="${database.url}"
initialContextFactory="${java.naming.factory.initial}"
providerURL="${java.naming.provider.url}"
datasourceJNDIName="${datasource.jndi.name}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}"
includeViews="false"
>
<hibernate
destination="${build.gen-src.dir}"
package="Hbm i klasy"
genXDocletTags="true"
javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
/>
</middlegen>
</target>
////////////////////////////////////////////////////////////////////////////
<target name="codegen" depends="middlegen">
<taskdef name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="lib.class.path"/>
<hbm2java config="codegen.cfg.xml"
output="${build.gen-src.dir}/generated/src/">
<fileset dir="${build.gen-src.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>
/////////////////////////////////////////////////////
The codegen.cfg.xml file:
Code:
<codegen>
<meta attribute="implements">org.hibernate.auction.model.Auditable</meta>
<generate suffix="AAA_" renderer="net.sf.Hibernate.tool.hbm2java.BasicRenderer"/>
<generate prefix="BBB_" renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer"/>
<generate renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer">
<param name="do-not-create-constructor">true</param>
</generate>
</codegen>
What is wrong???