-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Cannot do reverse engineering and HQL scratch pad problem
PostPosted: Tue May 08, 2007 7:23 pm 
Newbie

Joined: Tue May 08, 2007 2:09 pm
Posts: 1
Hi,

I'm a student-newbie trying to make a EJB 3.0 project on Eclipse 3.1.2, using JBoss-Eclipse IDE 1.6 which has Hibernate Tools in it.

I require to generate the POJOs using the Hibernate Tools Reverse Engineering feature.

I have created the hibernate config file, reveng file and the console configuration as per this:

http://www.hibernate.org/hib_docs/tools ... ugins.html

But I am not able to create the POJOs from my tables at all. There is no error in the error log and nothing happens when I saw 'run' on the code gen wizard.

I am not able to use the HQL scratch pad either. When I right click on the console config and say 'Create sessionfactory' there is nothing that happens.

Could somebody please help me out with some inputs?
I donot know if I am missing something?

Thanks,
Vasudha










[/list]


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 09, 2007 9:27 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
You'd be best off using an ant task to do your revenge generation. It's more portable if you need to setup shop somewhere else.

Here's mine you can use as a template obviously you'll need to change it for your project but it should give you an idea of where to start.

You may also find this post helpfull and the links it contains: http://forum.hibernate.org/viewtopic.php?t=973625

Code:
<project name="goFurtherTools" basedir="../" default="hibernateCodeGen">
   <property name="tools.dir" value="tools" />
   <property name="src.dir" value="src" />
   <property name="web.dir" value="web" />
   <property name="test.src" value="test" />
   <property name="lib.dir" value="${web.dir}/lib" />
   <property name="build.dir" value="build" />
   <property name="test.dir" value="${build.dir}/test" />
   <property name="webapp.name" value="goFurther" />
   <property name="gen.dir" value="gen" />

   <property environment="env" />
   <property name="ant.home" value="${env.ANT_HOME}" />
   <property name="tomcat.home" value="${env.CATALINA_HOME}" />
   <property name="tomcat.lib.dir" value="${tomcat.home}/common/lib" />

   <path id="classpath">
      <pathelement path="${java.class.path}/" />
      <pathelement path="${build.dir}/classes" />
      <pathelement path="${build.dir}/test/classes" />
      <fileset dir="${lib.dir}">
         <include name="**/*.jar" />
      </fileset>
   </path>

   <path id="toolslib">
      <path location="lib/hibernate-tools.jar" />
      <path location="lib/hibernate3.jar" />
      <path location="lib/freemarker.jar" />
      <path location="${jdbc.driver.jar}" />
   </path>

   <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />

   <target name="hibernateCodeGen">
      <copy todir="${build.dir}/classes" includeemptydirs="false" overwrite="true">
         <fileset dir="${tools.dir}/hibernate/config">
            <include name="*.*" />
         </fileset>
      </copy>

      <delete failonerror="false">
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/domain/data">
            <include name="*.*" />
         </fileset>
      </delete>
      <delete failonerror="false">
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/dao/base/hibernate">
            <include name="*.*" />
         </fileset>
      </delete>
      <delete failonerror="false">
         <fileset dir="${tools.dir}/hibernate/generated/config">
            <include name="*.*" />
         </fileset>
      </delete>
      <delete dir="${tools.dir}/hibernate/generated"/>

      <hibernatetool
         destdir="${tools.dir}/hibernate/generated"
         templatepath="${tools.dir}/hibernate/templates"
      >
         <classpath>
            <path location="${build.dir}/classes" />
            <path location="${basedir}/lib" />
         </classpath>
         <jdbcconfiguration
            packagename="uk.ltd.goFurther.domain"
            propertyfile="${tools.dir}/hibernate/config/hibernate.properties"
            reversestrategy="uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy"
            revengfile="${tools.dir}/hibernate/config/hibernate.reveng.xml"
         />
         <hbm2hbmxml />
      </hibernatetool>

      <hibernatetool
         destdir="${tools.dir}/hibernate/generated"
         templatepath="${tools.dir}/hibernate/templates"
      >
         <classpath>
            <path location="${build.dir}/classes" />
            <path location="${basedir}/lib" />
         </classpath>
         <jdbcconfiguration
            packagename="uk.ltd.goFurther.domain.data"
            propertyfile="${tools.dir}/hibernate/config/hibernate.properties"
            reversestrategy="uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy"
            revengfile="${tools.dir}/hibernate/config/hibernate.reveng.xml"
         />
         <hbm2java />
      </hibernatetool>

      <copy todir="${tools.dir}/hibernate/generated/config" includeemptydirs="false" overwrite="true">
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/domain">
            <include name="*.hbm.xml" />
         </fileset>
      </copy>
      <delete>
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/domain">
            <include name="*.hbm.xml" />
         </fileset>
      </delete>

      <mkdir dir="${tools.dir}/hibernate/generated/tmp"/>

      <copy todir="${tools.dir}/hibernate/generated/tmp" includeemptydirs="false" overwrite="true">
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/domain/data">
            <include name="*.*" />
         </fileset>
         <globmapper from="*.java" to="*Data.java"/>
      </copy>
      <delete>
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/domain/data">
            <include name="*.java" />
         </fileset>
      </delete>
      <copy todir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/domain/data" includeemptydirs="false" overwrite="true">
         <fileset dir="${tools.dir}/hibernate/generated/tmp">
            <include name="*.java" />
         </fileset>
      </copy>
      <delete failonerror="false">
         <fileset dir="${tools.dir}/hibernate/generated/tmp">
            <include name="*.*" />
         </fileset>
      </delete>

      <hibernatetool
         destdir="${tools.dir}/hibernate/generated"
         templatepath="${tools.dir}/hibernate/templates"
      >
         <classpath>
            <path location="${build.dir}/classes" />
            <path location="${basedir}/lib" />
         </classpath>
         <jdbcconfiguration
            packagename="uk.ltd.goFurther.dao.base.hibernate"
            propertyfile="${tools.dir}/hibernate/config/hibernate.properties"
            reversestrategy="uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy"
            revengfile="${tools.dir}/hibernate/config/hibernate.reveng.xml"
         />
         <hbm2dao />
      </hibernatetool>
      <copy todir="${tools.dir}/hibernate/generated/tmp" includeemptydirs="false" overwrite="true">
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/dao/base/hibernate">
            <include name="*.*" />
         </fileset>
         <globmapper from="*Home.java" to="*DAOBaseHibernate.java"/>
      </copy>
      <delete failonerror="false">
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/dao/base/hibernate">
            <include name="*.*" />
         </fileset>
      </delete>
      <copy todir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/dao/base/hibernate" includeemptydirs="false" overwrite="true">
         <fileset dir="${tools.dir}/hibernate/generated/tmp">
            <include name="*.*" />
         </fileset>
      </copy>
      <delete failonerror="false">
         <fileset dir="${tools.dir}/hibernate/generated/tmp">
            <include name="*.*" />
         </fileset>
      </delete>
      <delete dir="${tools.dir}/hibernate/generated/tmp"/>
       
      <delete failonerror="false">
         <fileset dir="${src.dir}/java/uk/ltd/goFurther/dao/base/hibernate">
            <include name="*.*" />
         </fileset>
      </delete>       
      <delete failonerror="false">
         <fileset dir="${src.dir}/java/uk/ltd/goFurther/domain/data">
            <include name="*.*" />
         </fileset>
      </delete>       
      <delete failonerror="false">
         <fileset dir="${src.dir}/java/uk/ltd/goFurther/domain/conf">
            <include name="*.*" />
         </fileset>
      </delete>       

      <copy todir="${src.dir}/java/uk/ltd/goFurther/dao/base/hibernate" includeemptydirs="false" overwrite="true">
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/dao/base/hibernate">
            <include name="*.*" />
         </fileset>
      </copy>
      <copy todir="${src.dir}/java/uk/ltd/goFurther/domain/data" includeemptydirs="false" overwrite="true">
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/domain/data">
            <include name="*.*" />
         </fileset>
      </copy>
      <copy todir="${src.dir}/java/uk/ltd/goFurther/domain/conf" includeemptydirs="false" overwrite="true">
         <fileset dir="${tools.dir}/hibernate/generated/config">
            <include name="*.*" />
         </fileset>
      </copy>
   </target>
</project>


_________________
Everytime you get an answer to your question without giving credit; god kills a kitten. :(


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 10, 2007 4:48 am 
Regular
Regular

Joined: Thu Apr 05, 2007 7:05 am
Posts: 53
Location: Troisdorf, Germany
What version of HibernateTools and which kind of database are you using? Perhaps I can help you when you give me some more information because I had the same problems just some weeks before.

Here some things you should have done:
* Add Hibernate librarys (not only hibernate-tools) to the build path of your project.
* Add in the console configuration database driver and path to class and src folder.


Top
 Profile  
 
 Post subject: Re: Cannot do reverse engineering and HQL scratch pad proble
PostPosted: Thu May 10, 2007 11:11 am 
Newbie

Joined: Thu May 10, 2007 9:39 am
Posts: 3
Location: Germany
Is your Eclipse running in JRE 1.5 or higher?
Please look at Help- About - Configuration Details: java.version.

vasudha_v2000 wrote:
Hi,

But I am not able to create the POJOs from my tables at all. There is no error in the error log and nothing happens when I saw 'run' on the code gen wizard.

I am not able to use the HQL scratch pad either. When I right click on the console config and say 'Create sessionfactory' there is nothing that happens.
[/list]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.