我想Hibernate Tools
用于逆向工程。
我的数据库是PostgreSQL
. 问题是关于hbm.xml
文件的。逆向工程工具创建错误hbm.xml
的文件。所以,我想使用custom reverse engineering strategy.
我正在使用Java.
CustomReverseEngineeringStrategy
课程在这里:
public class CustomReverseEngineeringStrategy extends DelegatingReverseEngineeringStrategy{
public CustomReverseEngineeringStrategy(ReverseEngineeringStrategy delegate) {
super(delegate);
}
public CustomReverseEngineeringStrategy(){
super(new CustomReverseEngineeringStrategy());
}
public Properties getTableIdentifierProperties(TableIdentifier arg0) {
Properties pr = new Properties();
pr.put("sequence", "test_id_seq");
return pr;
}
public String getTableIdentifierStrategyName(TableIdentifier arg0) {
return "sequence";
}
}
[编辑]
我写了Ant
taskdef,我有一个错误。
这是我的build.xml
文件:
<?xml version="1.0"?>
<!-- define the project -->
<project name="sample_BookCatalog" default="build" basedir=".">
<!-- define project properties -->
<property name="compiler" value="modern" />
<property name="fork" value="no" />
<property name="verbose" value="no" />
<property name="debug" value="on" />
<property name="optimize" value="on" />
<property name="deprecation" value="on" />
<property name="target" value="1.5" />
<property name="source" value="1.5" />
<property file="build.properties" />
<property environment="env" />
<!-- define properties to refer to directories in the project -->
<property name="webinf.dir" value="WEB-INF" />
<property name="webinf.lib.dir" value="WEB-INF/lib" />
<property name="lib.dir" value="lib" />
<property name="src.dir" value="src" />
<property name="test.dir" value="test" />
<property name="build.dir" value="build" />
<property name="webinf.classes.dir" value="${webinf.dir}/classes" />
<property name="webinf.classes.content.dir" value="${webinf.dir}/classes/content" />
<property name="web.xml" value="${webinf.dir}/web.xml" />
<fileset id="webapp.libs" dir="${webinf.lib.dir}">
<include name="*.jar" />
</fileset>
<fileset id="libs" dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<path id="class.path">
<pathelement path="${webinf.classes.dir}" />
<fileset refid="webapp.libs" />
<fileset dir = "${webinf.lib.dir}" includes="**/*.jar"/>
<fileset refid="libs" />
</path>
<pathconvert pathsep=":" property="class.path" refid="class.path" />
<fileset id="war.files" dir=".">
<include name="${webinf.dir}/**" />
<exclude name="${webinf.dir}/Language-ext.properties" />
<include name="images/**" />
<include name="css/**" />
<include name="js/**" />
<exclude name="${web.xml}" />
</fileset>
<!-- compile target to compile the sources -->
<target name="compile">
<mkdir dir="${webinf.classes.dir}" />
<!-- Content directory contains Liferay resource bundle-->
<mkdir dir="${webinf.classes.content.dir}" />
<javac srcdir="${src.dir}:${test.dir}" destdir="${webinf.classes.dir}" fork="${fork}" verbose="${verbose}" deprecation="${deprecation}" debug="${debug}" optimize="${optimize}" compiler="${compiler}" target="${target}" source="${source}">
<classpath refid="class.path" />
</javac>
<copy todir="${webinf.classes.dir}" preservelastmodified="true">
<fileset dir="${src.dir}">
<include name="**/*.properties" />
<include name="**/*.xml" />
</fileset>
</copy>
<copy todir="${webinf.classes.content.dir}">
<fileset dir="${webinf.dir}">
<include name="Language-ext.properties" />
</fileset>
</copy>
</target>
<!-- <taskdef name="mytask" classname="com.project.strategy.Reverse"/> -->
<property name="my.classes" value="${webinf.classes.dir}" />
<taskdef name="mytask" classpath="${my.classes}" classname="com.project.strategy.Reverse"/>
<!-- target to create the project WAR file -->
<target name="build" depends="clean,compile">
<mkdir dir="${build.dir}" />
<war destfile="${build.dir}/sample_BookCatalog.war" webxml="${web.xml}">
<fileset refid="war.files" />
</war>
<copy todir="${liferay.portal.home}/deploy">
<fileset dir="${build.dir}">
<include name="**/*.war" />
</fileset>
</copy>
</target>
<!-- target to clean up all files created by various tasks -->
<target name="clean">
<delete quiet="true" includeemptydirs="true">
<fileset dir="${webinf.classes.dir}" includes="**/*" />
<fileset dir="${build.dir}" />
<fileset dir="${work.dir}" />
</delete>
</target>
</project>
这是错误:
No public execute() in class com.project.strategy.Reverse
问候