How to Use JPOX in NetBeans 4.0
March 6, 2005 on 10:45 pm | In Java, NetBeans |JPOX is the most popular implementation of the JDO specifications. However, the downside of using JPOX for object-relational mapping is the need to enhance classes after they have been compiled. Thankfully, developers can take advantage of the Ant-based nature of NetBeans projects to automate this task. Here, I show you how to do this.
First, download JPOX Core and JPOX Enhancer.
Next, copy JPOX Enhancer and its dependencies to a folder of your choice, and copy JPOX Core to the library folder within your NetBeans project (which is usually /lib).
Last, override the -pre-dist target in build.xml with the JDO enhancement task. This instructs Ant to enhance the compiled classes before packaging the project.
<target name="-pre-dist">
<echo message="==================================================================="/>
<echo message="Enhancing the MODULE files"/>
<echo message="==================================================================="/>
<property name="jpox.dir" value="/Users/jeyoung/Dev/JPOX"/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}"
includes="**/*.jdo,**/*.properties,**/*.dtd,**/*.xml"/>
</copy>
<path id="module.enhancer.classpath">
<fileset dir="${jpox.dir}" includes="*.jar"/>
<pathelement location="${build.classes.dir}"/>
<pathelement location="${build.web.dir}/WEB-INF/lib/jpox-1.1.0-beta-1.jar"/>
</path>
<taskdef name="jpoxenhancer"
classpathref="module.enhancer.classpath"
classname="org.jpox.enhancer.tools.EnhancerTask" />
<jpoxenhancer classpathref="module.enhancer.classpath"/>
</target>
Once this is done, the meta-data for the object-relational mapping of your classes can be modified at will, and the next time the project is built, the compiled classes will automatically be enhanced.
Technorati Tags: Java
Related Posts:
- HOWTO: Improved JPOX integration with NetBeans 4.0
- Using Apache Axis in NetBeans 5.0
- Using JPOX in NetBeans IDE
- How to Develop JSF Applications in NetBeans
No Comments yet »
RSS feed for comments on this post.
Leave a comment
Powered by blog.mu with Pool theme design by Borja Fernandez.

