I found a job for this problem. The problem itself seems to be due to the fact that Netbeans 6.5 (and later versions up to this point) do not allow you to process the database from the existing hibernate.reveng.xml file. It will be available in version 7.
The work discovered is to create an ant task to recreate the hbm.xml and pojo java files. Currently, this happens for me when I am doing clean and assembly, but I will try to find a way to completely separate it, since this will only need to be run when the database schema changes.
To accomplish this when you do clean and build, but you need to edit the build.xml file.
The first part is the libraries you need. So add:
<path id="toolslib"> <path location="lib/hibernate-support/hibernate-tools.jar" /> <path location="lib/hibernate-support/hibernate3.jar" /> <path location="lib/hibernate-support/freemarker.jar" /> <path location="lib/hibernate-support/jtidy-r938.jar" /> <path location="lib/ojdbc14.jar" /> </path>
You should already have the hibernate-tools.jar, hibernate3.jar, and ojdbc14.jar files on your computer. So just change the path to them. freemaker.jar and jtidy-r938.jar will need to be downloaded, since I didnβt have them.
Below this in build.xml you need to add:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib"> <classpath> <fileset dir="lib"> <include name="**/*.jar"/> </fileset> </classpath> </taskdef>
The last section you will need is the set to run in the section after cleaning:
<target name="-post-clean"> <delete dir="src/*Put the foler where your pojos and hbm.xml files are located*"/> <hibernatetool> <jdbcconfiguration configurationfile="src\hibernate.cfg.xml" packagename="*the package where you want them recreated*" revengfile="src\hibernate.reveng.xml" detectmanytomany="true" /> <hbm2hbmxml destdir="src" /> <hbm2java destdir="src" /> </hibernatetool> </target>
- The deletion part will delete the existing hbm and pojo files before they are recreated.
configurationfile points to your main configuration file.- The package name is the point package you want to create (
com.stackoverflow.pojo for example). revengfile is a reverse engineering XML file that should be used when creating hbm and pojo files.hbm2hbmxml will create the hbm2hbmxml files of your tables.hbm2java will create the java pojo files of your tables.
Now for the Oracle Timestamps to be something other than Serializable , edit the hibernate.reveng.xml file and add:
<type-mapping> <sql-type jdbc-type="OTHER" hibernate-type="java.sql.Timestamp" /> </type-mapping>
immediately after the schema select tag.
Thus, pure and string and timestamps will not be java.sql.Timestamp instead of Serializable objects.
This is a long answer that I know, but it should also work for any other changes that you will need to install in the hibernate.reveng.xml file (I think). I am not an expert in sleep mode, so your mileage may change.
UPDATE: Therefore, after some searches, I found this site about user ant tasks in Netbeans. Therefore, I just changed the name of the target as gen-dao , and now it does not start every time I do a clean and build, only when I specifically call it.