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.  [ 6 posts ] 
Author Message
 Post subject: ${FK_Table}By${col_name}???
PostPosted: Tue Apr 24, 2007 6:01 pm 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
Hi everyone.

I'm using reverse engineering to generate my hbm.xml files, domain and DAO objects. One thing I've noticed in the hbm is I get output such as the follow:
Code:
<many-to-one name="teamByWhiteTeam" class="uk.ltd.goFurther.domain.data.Team" fetch="select">
    <column name="whiteTeam" not-null="true" />
</many-to-one>


As you can see from the column name the name is whiteTeam but hibernate decides a better name for it in the hbm and so the domain object would be teamByWhiteTeam. I think this is because I have 2 columns that are a FK to the same table. Basically black and white team pointing to the team table.
If you want to see my full DB schema it's in the post below.

Original post -- http://forum.hibernate.org/viewtopic.php?p=2348525

I was wondering if there was anyway to use revenge or a template to get rid of the teamBy as above and just have the many-to-one name="whiteTeam".
Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 24, 2007 7:27 pm 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Override foreignKeyToCollectionName in the ReverseEngineeringStrategy, e.g.

Code:
   public String foreignKeyToCollectionName(String keyname, TableIdentifier fromTable, List fromColumns,
         TableIdentifier referencedTable, List referencedColumns, boolean uniqueReference) {
      String propertyName = super.foreignKeyToCollectionName(keyname, fromTable, fromColumns, referencedTable,
            referencedColumns, uniqueReference);
      if (!uniqueReference) {
         String suffix = propertyName.substring(propertyName.indexOf("For"));
         propertyName = ReverseEngineeringStrategyUtil.simplePluralize(Introspector.decapitalize(StringHelper
               .unqualify(tableToClassName(fromTable))))
               + suffix;
      }
      return propertyName;
   }


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 6:57 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
Hi, thanks for that Ananasi. Rate up for you! ^_^

I've made a CustomReverseEngineeringStrategy:
Code:
package uk.ltd.goFurther.tools.hibernate.reverseEngineering;

import java.beans.Introspector;
import java.util.List;

import org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategyUtil;
import org.hibernate.cfg.reveng.TableIdentifier;
import org.hibernate.util.StringHelper;

public class CustomReverseEngineeringStrategy extends DelegatingReverseEngineeringStrategy{

    public CustomReverseEngineeringStrategy(ReverseEngineeringStrategy delegate) {
        super(delegate);
    }

    public String foreignKeyToCollectionName(
        String keyname,
        TableIdentifier fromTable,
        List fromColumns,
        TableIdentifier referencedTable,
        List referencedColumns,
        boolean uniqueReference
    ){
       String propertyName = super.foreignKeyToCollectionName(
           keyname,
           fromTable,
           fromColumns,
           referencedTable,
           referencedColumns,
           uniqueReference
       );
       if(!uniqueReference){
           String suffix = propertyName.substring(propertyName.indexOf("For"));
           propertyName = ReverseEngineeringStrategyUtil.simplePluralize(
               Introspector.decapitalize(
                   StringHelper.unqualify(tableToClassName(fromTable))
                )
            )
            + suffix;
        }
        return propertyName;
    }
}


And editied my hibernate.properties file to call this:
Code:
hibernate.bytecode.use_reflection_optimizer = false
hibernate.connection.driver_class = net.sourceforge.jtds.jdbc.Driver
hibernate.connection.password = hibernate
hibernate.connection.url = jdbc:jtds:sqlserver://localhost:1433/goFurther
hibernate.connection.username = hibernate
hibernate.dialect = org.hibernate.dialect.SQLServerDialect
hibernate.show_sql = false
hibernatetool.reveng.strategy=uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy

From my ant task...
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">
      <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
            configurationfile="${tools.dir}/hibernate/config/hibernate.cfg.xml"
            packagename="uk.ltd.goFurther.domain.data"
            revengfile="${tools.dir}/hibernate/config/hibernate.reveng.xml"
         />
         <hbm2hbmxml />
         <hbm2java />
      </hibernatetool>

      <copy todir="${tools.dir}/hibernate/generated/config" includeemptydirs="false" overwrite="true">
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/domain/data">
            <include name="*.hbm.xml" />
         </fileset>
      </copy>
      <delete>
         <fileset dir="${tools.dir}/hibernate/generated/uk/ltd/goFurther/domain/data">
            <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
            configurationfile="${tools.dir}/hibernate/config/hibernate.cfg.xml"
            packagename="uk.ltd.goFurther.dao.base.hibernate"
            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>

However I still get the same problem in the generated hbm.xml and data objects. =(
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 25-Apr-2007 11:29:41 by Hibernate Tools 3.2.0.beta8 -->
<hibernate-mapping>
    <class name="uk.ltd.goFurther.domain.data.Game" table="Game" schema="dbo" catalog="goFurther">
        <id name="id" type="int">
            <column name="id" />
            <generator class="assigned" />
        </id>
        <version name="version" type="int">
            <column name="version" not-null="true" />
        </version>
        <many-to-one name="location" class="uk.ltd.goFurther.domain.data.Location" fetch="select">
            <column name="location" not-null="true" />
        </many-to-one>
        <many-to-one name="teamByWhiteTeam" class="uk.ltd.goFurther.domain.data.Team" fetch="select">
            <column name="whiteTeam" not-null="true" />
        </many-to-one>
        <many-to-one name="teamByBlackTeam" class="uk.ltd.goFurther.domain.data.Team" fetch="select">
            <column name="blackTeam" not-null="true" />
        </many-to-one>
        <many-to-one name="gameType" class="uk.ltd.goFurther.domain.data.GameType" fetch="select">
            <column name="gameType" not-null="true" />
        </many-to-one>
        <property name="name" type="string">
            <column name="name" length="100" not-null="true" />
        </property>
        <property name="creationDate" type="timestamp">
            <column name="creationDate" length="23" not-null="true" />
        </property>
        <property name="xsize" type="int">
            <column name="xSize" not-null="true" />
        </property>
        <property name="ysize" type="int">
            <column name="ySize" not-null="true" />
        </property>
        <set name="gamePlaies" inverse="true">
            <key>
                <column name="game" not-null="true" />
            </key>
            <one-to-many class="uk.ltd.goFurther.domain.data.GamePlay" />
        </set>
    </class>
</hibernate-mapping>

Here's the output from my ant task everything looks like it's working ok...
Code:
Buildfile: C:\goFurther\tools\build.xml
hibernateCodeGen:
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\domain\data
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\dao\base\hibernate
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\config
   [delete] Deleting directory C:\goFurther\tools\hibernate\generated
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernatetool] 1. task: hbm2hbmxml (Generates a set of hbm.xml files)
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.2.0.cr5
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.cfg.Environment buildBytecodeProvider
[hibernatetool] INFO: Bytecode provider name : cglib
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate.cfg.xml
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.cfg.Configuration doConfigure
[hibernatetool] INFO: Configured SessionFactory: goFurther
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.cfg.reveng.OverrideRepository addFile
[hibernatetool] INFO: Override file: C:\goFurther\tools\hibernate\config\hibernate.reveng.xml
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Hibernate connection pool size: 20
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: autocommit mode: false
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: using driver: net.sourceforge.jtds.jdbc.Driver at URL: jdbc:jtds:sqlserver://localhost:1433/goFurther
[hibernatetool] 25-Apr-2007 11:29:40 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: connection properties: {user=hibernate, password=****}
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: RDBMS: Microsoft SQL Server, version: 09.00.1399
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.dialect.Dialect <init>
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.SQLServerDialect
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
[hibernatetool] INFO: Using default transaction strategy (direct JDBC transactions)
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
[hibernatetool] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic flush during beforeCompletion(): disabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic session close at end of transaction: disabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Scrollable result sets: enabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC3 getGeneratedKeys(): enabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Connection release mode: auto
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default batch fetch size: 1
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Generate SQL with comments: disabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Order SQL updates by primary key: disabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
[hibernatetool] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
[hibernatetool] INFO: Using ASTQueryTranslatorFactory
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query language substitutions: {}
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JPA-QL strict compliance: disabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Second-level cache: enabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query cache: disabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory createCacheProvider
[hibernatetool] INFO: Cache provider: org.hibernate.cache.NoCacheProvider
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Optimize cache for minimal puts: disabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Structured second-level cache entries: disabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Statistics: disabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Deleted entity synthetic identifier rollback: disabled
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default entity-mode: pojo
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.connection.DriverManagerConnectionProvider close
[hibernatetool] INFO: cleaning up connection pool: jdbc:jtds:sqlserver://localhost:1433/goFurther
[hibernatetool] 25-Apr-2007 11:29:41 org.hibernate.tool.Version <clinit>
[hibernatetool] INFO: Hibernate Tools 3.2.0.beta8
25-Apr-2007 11:29:42 org.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:jtds:sqlserver://localhost:1433/goFurther
[hibernatetool] 2. task: hbm2java (Generates a set of .java files)
     [copy] Copying 14 files to C:\goFurther\tools\hibernate\generated\config
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\domain\data
    [mkdir] Created dir: C:\goFurther\tools\hibernate\generated\tmp
     [copy] Copying 14 files to C:\goFurther\tools\hibernate\generated\tmp
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\domain\data
     [copy] Copying 14 files to C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\domain\data
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\tmp
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernatetool] 1. task: hbm2dao (Generates a set of DAOs)
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate.cfg.xml
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.Configuration doConfigure
[hibernatetool] INFO: Configured SessionFactory: goFurther
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.reveng.OverrideRepository addFile
[hibernatetool] INFO: Override file: C:\goFurther\tools\hibernate\config\hibernate.reveng.xml
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Hibernate connection pool size: 20
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: autocommit mode: false
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: using driver: net.sourceforge.jtds.jdbc.Driver at URL: jdbc:jtds:sqlserver://localhost:1433/goFurther
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: connection properties: {user=hibernate, password=****}
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: RDBMS: Microsoft SQL Server, version: 09.00.1399
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.dialect.Dialect <init>
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.SQLServerDialect
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
[hibernatetool] INFO: Using default transaction strategy (direct JDBC transactions)
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
[hibernatetool] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic flush during beforeCompletion(): disabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic session close at end of transaction: disabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Scrollable result sets: enabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC3 getGeneratedKeys(): enabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Connection release mode: auto
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default batch fetch size: 1
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Generate SQL with comments: disabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Order SQL updates by primary key: disabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
[hibernatetool] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
[hibernatetool] INFO: Using ASTQueryTranslatorFactory
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query language substitutions: {}
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JPA-QL strict compliance: disabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Second-level cache: enabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query cache: disabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory createCacheProvider
[hibernatetool] INFO: Cache provider: org.hibernate.cache.NoCacheProvider
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Optimize cache for minimal puts: disabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Structured second-level cache entries: disabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Statistics: disabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Deleted entity synthetic identifier rollback: disabled
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default entity-mode: pojo
[hibernatetool] 25-Apr-2007 11:29:43 org.hibernate.connection.DriverManagerConnectionProvider close
[hibernatetool] INFO: cleaning up connection pool: jdbc:jtds:sqlserver://localhost:1433/goFurther
     [copy] Copying 14 files to C:\goFurther\tools\hibernate\generated\tmp
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\dao\base\hibernate
     [copy] Copying 14 files to C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\dao\base\hibernate
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\tmp
   [delete] Deleting directory C:\goFurther\tools\hibernate\generated\tmp
   [delete] Deleting 14 files from C:\goFurther\src\java\uk\ltd\goFurther\dao\base\hibernate
   [delete] Deleting 14 files from C:\goFurther\src\java\uk\ltd\goFurther\domain\data
   [delete] Deleting 14 files from C:\goFurther\src\java\uk\ltd\goFurther\domain\conf
     [copy] Copying 14 files to C:\goFurther\src\java\uk\ltd\goFurther\dao\base\hibernate
     [copy] Copying 14 files to C:\goFurther\src\java\uk\ltd\goFurther\domain\data
     [copy] Copying 14 files to C:\goFurther\src\java\uk\ltd\goFurther\domain\conf
BUILD SUCCESSFUL
Total time: 4 seconds

What am I missing? ._. Any help would be much appriciated.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 8:32 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
You must specify the ReverseEngineeringStrategy class in the jdbcconfiguration enclosing the hbm2hbmxml task. Here's mine, for instance:
Code:
<jdbcconfiguration packagename="com.eg.${project.name}.framework.model" propertyfile="build.properties" reversestrategy="com.eg.${project.name}.reveng.Strategy" revengfile="hibernate.reveng.xml"/>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 3:24 pm 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
Thanks for the reply Ananasi exactly what I was looking for.
I made a CustomReverseEngineeringStrategy:
Code:
public class CustomReverseEngineeringStrategy extends DelegatingReverseEngineeringStrategy{
    private static final Log log = LogFactory.getLog(CustomReverseEngineeringStrategy.class);
   
    public CustomReverseEngineeringStrategy(ReverseEngineeringStrategy delegate) {
        super(delegate);
    }

    public String foreignKeyToCollectionName(
        String keyname,
        TableIdentifier fromTable,
        List fromColumns,
        TableIdentifier referencedTable,
        List referencedColumns,
        boolean uniqueReference
    ){
       String propertyName = super.foreignKeyToCollectionName(
           keyname,
           fromTable,
           fromColumns,
           referencedTable,
           referencedColumns,
           uniqueReference
       );
       String suffix = null;
       if(!uniqueReference){
           if(log.isInfoEnabled()){
               log.info("\n\n\ndoing CustomReverseEngineeringStrategy...");
               log.info("propertyName:" + propertyName);
           }
           suffix = propertyName.substring(propertyName.indexOf("For"));
           if(suffix == null){
               propertyName = ReverseEngineeringStrategyUtil.simplePluralize(
                   Introspector.decapitalize(
                       StringHelper.unqualify(tableToClassName(fromTable))
                    )
                );
           }
           else{
               propertyName = Introspector.decapitalize(
                   StringHelper.replace(suffix, "For", "")
               );
           }
        }
        if(log.isInfoEnabled()){
            log.info("suffix:" + suffix);
            log.info("propertyName:" + propertyName);
        }
        return propertyName;
    }
}

And it seems to be working as you can see from my ant log:
Code:
Buildfile: C:\goFurther\tools\build.xml
hibernateCodeGen:
     [copy] Copying 3 files to C:\goFurther\build\classes
   [delete] C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\dao\base\hibernate not found.
   [delete] Deleting directory C:\goFurther\tools\hibernate\generated
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernatetool] 1. task: hbm2hbmxml (Generates a set of hbm.xml files)
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.2.0.cr5
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver, hibernatetool.reveng.package=uk.ltd.goFurther.domain.data, hibernate.dialect=org.hibernate.dialect.SQLServerDialect, hibernate.connection.username=hibernate, hibernate.connection.url=jdbc:jtds:sqlserver://localhost:1433/goFurther, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=false, hibernate.connection.password=****, hibernatetool.reveng.strategy=uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy}
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.Environment buildBytecodeProvider
[hibernatetool] INFO: Bytecode provider name : cglib
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.reveng.OverrideRepository addFile
[hibernatetool] INFO: Override file: C:\goFurther\tools\hibernate\config\hibernate.reveng.xml
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Hibernate connection pool size: 20
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: autocommit mode: false
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: using driver: net.sourceforge.jtds.jdbc.Driver at URL: jdbc:jtds:sqlserver://localhost:1433/goFurther
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: connection properties: {user=hibernate, password=****}
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: RDBMS: Microsoft SQL Server, version: 09.00.1399
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.dialect.Dialect <init>
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.SQLServerDialect
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
[hibernatetool] INFO: Using default transaction strategy (direct JDBC transactions)
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
[hibernatetool] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic flush during beforeCompletion(): disabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic session close at end of transaction: disabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Scrollable result sets: enabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC3 getGeneratedKeys(): enabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Connection release mode: auto
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default batch fetch size: 1
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Generate SQL with comments: disabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Order SQL updates by primary key: disabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
[hibernatetool] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
[hibernatetool] INFO: Using ASTQueryTranslatorFactory
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query language substitutions: {}
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JPA-QL strict compliance: disabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Second-level cache: enabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query cache: disabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory createCacheProvider
[hibernatetool] INFO: Cache provider: org.hibernate.cache.NoCacheProvider
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Optimize cache for minimal puts: disabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Structured second-level cache entries: disabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Statistics: disabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Deleted entity synthetic identifier rollback: disabled
[hibernatetool] 25-Apr-2007 20:20:07 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default entity-mode: pojo
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:gamePlaies
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:games
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:players
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:games
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:teams
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:locations
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:gamePlaies
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:playComments
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:plaies
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:plaies
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:playThreads
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:plaies
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:plaies
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:teamPlayers
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:teamPlayers
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO:
[hibernatetool] doing CustomReverseEngineeringStrategy...
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:gamesForWhiteTeam
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:ForWhiteTeam
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:whiteTeam
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO:
[hibernatetool] doing CustomReverseEngineeringStrategy...
[hibernatetool] 25-Apr-2007 20:20:07 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:gamesForBlackTeam
[hibernatetool] 25-Apr-2007 20:20:08 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:ForBlackTeam
[hibernatetool] 25-Apr-2007 20:20:08 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:blackTeam
[hibernatetool] 25-Apr-2007 20:20:08 org.hibernate.connection.DriverManagerConnectionProvider close
[hibernatetool] INFO: cleaning up connection pool: jdbc:jtds:sqlserver://localhost:1433/goFurther
25-Apr-2007 20:20:08 org.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:jtds:sqlserver://localhost:1433/goFurther
[hibernatetool] 25-Apr-2007 20:20:08 org.hibernate.tool.Version <clinit>
[hibernatetool] INFO: Hibernate Tools 3.2.0.beta8
[hibernatetool] 2. task: hbm2java (Generates a set of .java files)
     [copy] Copying 14 files to C:\goFurther\tools\hibernate\generated\config
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\domain\data
    [mkdir] Created dir: C:\goFurther\tools\hibernate\generated\tmp
     [copy] Copying 14 files to C:\goFurther\tools\hibernate\generated\tmp
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\domain\data
     [copy] Copying 14 files to C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\domain\data
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\tmp
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernatetool] 1. task: hbm2dao (Generates a set of DAOs)
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.reveng.OverrideRepository addFile
[hibernatetool] INFO: Override file: C:\goFurther\tools\hibernate\config\hibernate.reveng.xml
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Hibernate connection pool size: 20
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: autocommit mode: false
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: using driver: net.sourceforge.jtds.jdbc.Driver at URL: jdbc:jtds:sqlserver://localhost:1433/goFurther
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: connection properties: {user=hibernate, password=****}
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: RDBMS: Microsoft SQL Server, version: 09.00.1399
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.dialect.Dialect <init>
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.SQLServerDialect
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
[hibernatetool] INFO: Using default transaction strategy (direct JDBC transactions)
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
[hibernatetool] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic flush during beforeCompletion(): disabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic session close at end of transaction: disabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Scrollable result sets: enabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC3 getGeneratedKeys(): enabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Connection release mode: auto
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default batch fetch size: 1
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Generate SQL with comments: disabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Order SQL updates by primary key: disabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
[hibernatetool] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
[hibernatetool] INFO: Using ASTQueryTranslatorFactory
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query language substitutions: {}
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JPA-QL strict compliance: disabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Second-level cache: enabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query cache: disabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory createCacheProvider
[hibernatetool] INFO: Cache provider: org.hibernate.cache.NoCacheProvider
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Optimize cache for minimal puts: disabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Structured second-level cache entries: disabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Statistics: disabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Deleted entity synthetic identifier rollback: disabled
[hibernatetool] 25-Apr-2007 20:20:09 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default entity-mode: pojo
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:gamePlaies
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:games
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:players
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:games
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:teams
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:locations
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:gamePlaies
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:playComments
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:plaies
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:plaies
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:playThreads
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:plaies
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:plaies
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:teamPlayers
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:null
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:teamPlayers
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO:
[hibernatetool] doing CustomReverseEngineeringStrategy...
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:gamesForWhiteTeam
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:ForWhiteTeam
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:whiteTeam
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO:
[hibernatetool] doing CustomReverseEngineeringStrategy...
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:gamesForBlackTeam
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: suffix:ForBlackTeam
[hibernatetool] 25-Apr-2007 20:20:10 uk.ltd.goFurther.tools.hibernate.reverseEngineering.CustomReverseEngineeringStrategy foreignKeyToCollectionName
[hibernatetool] INFO: propertyName:blackTeam
[hibernatetool] 25-Apr-2007 20:20:10 org.hibernate.connection.DriverManagerConnectionProvider close
[hibernatetool] INFO: cleaning up connection pool: jdbc:jtds:sqlserver://localhost:1433/goFurther
     [copy] Copying 14 files to C:\goFurther\tools\hibernate\generated\tmp
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\dao\base\hibernate
     [copy] Copying 14 files to C:\goFurther\tools\hibernate\generated\uk\ltd\goFurther\dao\base\hibernate
   [delete] Deleting 14 files from C:\goFurther\tools\hibernate\generated\tmp
   [delete] Deleting directory C:\goFurther\tools\hibernate\generated\tmp
   [delete] Deleting 14 files from C:\goFurther\src\java\uk\ltd\goFurther\dao\base\hibernate
   [delete] Deleting 14 files from C:\goFurther\src\java\uk\ltd\goFurther\domain\data
   [delete] Deleting 14 files from C:\goFurther\src\java\uk\ltd\goFurther\domain\conf
     [copy] Copying 14 files to C:\goFurther\src\java\uk\ltd\goFurther\dao\base\hibernate
     [copy] Copying 14 files to C:\goFurther\src\java\uk\ltd\goFurther\domain\data
     [copy] Copying 14 files to C:\goFurther\src\java\uk\ltd\goFurther\domain\conf
BUILD SUCCESSFUL
Total time: 4 seconds

But I still have an issue in that my hbm.xmls still have:
Code:
        <many-to-one name="teamByWhiteTeam" class="uk.ltd.goFurther.domain.data.Team" fetch="select">
            <column name="whiteTeam" not-null="true" />
        </many-to-one>

:(

How come the newly generated property name isn't going into the hbms and data accesss objects?

Any help would be much appriciated. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 5:51 pm 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
I believe that you will also have to override the foreignKeyToEntityName method to change that. The parameters should be self evident.


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