-->
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.  [ 5 posts ] 
Author Message
 Post subject: Need help running Ant task for Hiberante Tools via Maven
PostPosted: Tue Apr 14, 2009 4:35 pm 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
Hibernate version: hibernate-annotations 3.3.1, hibernate-commons-annotations 3.3.0.ga, hibernate-entitymanager3.3.2, hibernate-core 3.2

Name and version of the database you are using: Orcale XE 10g Release 2 (10.2)

I am using Hibernate Tools 3.2.4.CR2 with Eclipse 3.3.2
---------------------------------------------------------------------------------------

I am trying to use the reverse engineer feature with Hibernate Tools via ant. I run successfully but does not generate my classes. I don't get any error message or logs that indicates something is wrong.

Note: this all works when I set the properties through the Eclipse plugin for Hibernate Tools. But now I am trying to do the same thing through maven and ant. Any help is and will be much appreciated.

Thanks!

Tonté


Here is what my build.xml file looks like:
Code:
<project name="jedi-persistence">
   <taskdef classname="org.hibernate.tool.ant.HibernateToolTask" name="hibernatetool" classpath="${test_classpath}" />

   <target name="generate-domain">

      <delete dir="${output_dir}" quiet="true" />
      <mkdir dir="${output_dir}" />
      <hibernatetool destdir="${output_dir}">
         <jdbcconfiguration
            packagename="com.aviall.edi.jedi.persistence.core.models.generated"
            revengfile="${basedir}\src\main\resources\META-INF\hibernate.reveng.xml" 
            detectmanytomany="true"               
            configurationfile="${basedir}\src\main\resources\META-INF\hibernate.cfg.xml"/> <!-- packagename="" reversestrategy="" detectoptmisticlock="true|false"-->
                  
         <hbmtemplate
            templateprefix="pojo/"
            template="pojo/Pojo.ftl"
            filepattern="{package-name}/{class-name}.java"
            exporterclass="org.hibernate.tool.hbm2x.POJOExporter">

           <property key="jdk5" value="true" />
           <property key="ejb3" value="true" />
         </hbmtemplate>
         
      </hibernatetool>
   </target>
</project>


Here is what my console looks like:
Code:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building jedi-persistence
[INFO]
[INFO] Id: com.aviall.edi:jedi-persistence:jar:0.0.1-SNAPSHOT
[INFO] task-segment: [generate-sources]
[INFO] ------------------------------------------------------------------------
[INFO] [antrun:run]
[INFO] Executing tasks

generate-domain:
   [delete] Deleting directory C:\Dev\aviall_jedi_workspace\jedi-persistence\target\generated
    [mkdir] Created dir: C:\Dev\aviall_jedi_workspace\jedi-persistence\target\generated
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernatetool] 1. task: generic exporterclass: org.hibernate.tool.hbm2x.POJOExportertemplate: pojo/Pojo.ftl
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Tue Apr 14 15:28:15 CDT 2009
[INFO] Final Memory: 2M/8M
[INFO] ------------------------------------------------------------------------


Here is my reveng.xml file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>
   <type-mapping>
      <!-- jdbc-type is name from java.sql.Types -->
      <sql-type jdbc-type="TIMESTAMP" hibernate-type="java.sql.Timestamp" />
      <sql-type jdbc-type="NUMERIC" precision='1' hibernate-type="boolean" />
      <sql-type jdbc-type="NUMERIC" precision="15" hibernate-type="big_decimal" />
      <sql-type jdbc-type="NUMERIC" not-null="true" hibernate-type="long" />
      <sql-type jdbc-type="NUMERIC" not-null="false" hibernate-type="java.lang.Long" />
      <sql-type jdbc-type="VARCHAR" length="1" not-null="true" hibernate-type="java.lang.Character" />
      <sql-type jdbc-type="VARCHAR" hibernate-type="your.package.TrimStringUserType" />
      <sql-type jdbc-type="VARCHAR" length="1" hibernate-type="char" />
      <sql-type jdbc-type="VARCHAR" length='1' hibernate-type="yes_no" />
      <sql-type jdbc-type="VARCHAR" hibernate-type="string" />
   </type-mapping>


   <table-filter match-schema="JEDIDEV" match-name="PERSON"/>

   <!-- table allows you to override/define how reverse engineering is done for a specific table -->

   <table name="PERSON" class="com.aviall.edi.jedi.persistence.core.models.generated.Person">
      <meta attribute="extra-import">com.aviall.persistence.commons.models.BaseModel</meta>
      <meta attribute="extends">BaseModel</meta>
      <meta attribute="class-description">Person class.</meta>
      <primary-key>
         <!-- setting up a specific id generator for a table -->
         <generator class="sequence">
            <param name="sequence">PERSON_SEQ</param>
         </generator>

         <key-column name="ID" type="Long" />
      </primary-key>

      <column name="FIRST_NAME" property="firstName" type="string" />
      <column name="LAST_NAME" property="lastName" type="string" />
      <column name="MIDDLE_NAME" property="middleName" type="string" />
   </table>


</hibernate-reverse-engineering>



Here is my pom.xml:
Code:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.aviall.edi</groupId>
   <artifactId>jedi-persistence</artifactId>
   <packaging>jar</packaging>
   <version>0.0.1-SNAPSHOT</version>
   <name>jedi-persistence</name>
   <url>http://maven.apache.org</url>
   <build>
      <!-- To define the plugin version in your parent POM -->
      <pluginManagement>
         <plugins>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-antrun-plugin</artifactId>
               <version>1.3</version>
            </plugin>
         </plugins>
      </pluginManagement>
      <!-- To use the plugin goals in your POM or parent POM -->
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.3</version>
            <executions>
               <execution>
                  <id>generate-domain</id>
                  <phase>generate-sources</phase>
                  <configuration>
                     <tasks>
                        <property name="compile_classpath" refid="maven.compile.classpath" />
                        <property name="runtime_classpath" refid="maven.runtime.classpath" />
                        <property name="test_classpath" refid="maven.test.classpath" />
                        <property name="plugin_classpath" refid="maven.plugin.classpath" />
                        <property name="output_dir" value="${basedir}/target/generated"/>
                        <ant antfile="${basedir}/build.xml">
                           <target name="generate-domain" />
                        </ant>
                     </tasks>
                  </configuration>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
            </executions>

         </plugin>
      </plugins>
   </build>




   <dependencies>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>3.8.1</version>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-entitymanager</artifactId>
         <version>3.4.0.GA</version>
      </dependency>

      <dependency>
         <groupId>com.oracle</groupId>
         <artifactId>ojdbc14</artifactId>
         <version>1.4</version>
      </dependency>
      
      <!-- START Hibernate tools dependencies -->
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-tools</artifactId>
         <version>3.2.4.CR2</version>
         <type>jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>commons-logging</groupId>
         <artifactId>commons-logging</artifactId>
         <version>1.1.1</version>
         <type>jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-log4j12</artifactId>
         <version>1.5.6</version>
         <type>jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
         <version>1.5.6</version>
         <type>jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>cglib</groupId>
         <artifactId>cglib</artifactId>
         <version>2.2</version>
         <type>jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>freemarker</groupId>
         <artifactId>freemarker</artifactId>
         <version>2.3.15</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-tools</artifactId>
         <version>3.2.3.GA</version>
         <type>jar</type>
         <scope>test</scope>
      </dependency>
      
      <!-- END Hibernate tools dependencies -->
   </dependencies>
</project>

_________________
pouncilt


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 15, 2009 7:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what is your default_schema set to ? oracle is case sensitive so if it is SCOTT it should be SCOTT and not scott.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 15, 2009 7:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what is your default_schema set to ? oracle is case sensitive so if it is SCOTT it should be SCOTT and not scott.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 15, 2009 9:33 am 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
Is it not clear from my reveng.xml what my schema name is? Am I supposed to specifically set my default schema name in the reveng.xml? My schema name is JEDIDEV.

Does this answer your question?

Thanks!

_________________
pouncilt


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 15, 2009 2:12 pm 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
Max,

I fixed my default schema in my hibernate.cfg.xml file and all word out.

Thanks!

Tonté

_________________
pouncilt


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.