如何用JDO开发数据库应用(二)

http://tech.ddvip.com   2006年04月01日    社区交流

本文详细介绍如何用JDO开发数据库应用(二)

  4.4. 增强我们的数据对象类代码

  配置信息写完了,metadata也生成好了,下面就是用JDOGenie的类代码增强器增强我们编译生成的类代码。在这里,由于需要配置一些CLASSPATH、JDO文件路径等,我们写了一段Ant脚本来完成这些麻烦的工作。

  这个Ant脚本保存在我们的项目根目录下,名为“build.xml”:

  <?xml version="1.0" encoding="GB2312" ?>
<project name="creditSys" default="enhance">
<property name="src" location="src" />
<property name="build" location="classes" />
<property name="jdbc.jar" location="d:/bak/lib/mysql.jar" />
<path id="cp">
<pathelement path="${build}"/>
<pathelement path="${jdbc.jar}"/>
<fileset dir="." includes="*.jar" />
</path>
<target name="cleanup" description="清除所有编译生成的class文件">
<delete>
<fileset dir="${build}" includes="**/*.class"/>
</delete>
</target>
<target name="compile">
<javac debug="true" destdir="${build}" srcdir="${src}" classpathref="cp"/>
</target>
<target name="enhance" depends="cleanup, compile">
<taskdef classpathref="cp" resource="jdogenie.tasks"/>
<jdo-enhance project="${ant.project.name}.jdogenie" outputdir="${build}" />
</target>
<target name="run" description="运行credit.system.Main类,测试功能"> <java classname="credit.system.Main" classpathref="cp" fork="true" /> </target>
</project>

责编:豆豆技术应用

正在加载评论...