-->
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.  [ 3 posts ] 
Author Message
 Post subject: IndexOutOfBoundsException: on code generation
PostPosted: Sun Apr 29, 2007 1:05 am 
Newbie

Joined: Thu Mar 01, 2007 12:27 pm
Posts: 2
Hi,
Using code generation with hibernate 3.0 and HibernateTools-3.2.0.beta9a, I get the following error.

I am using MySQL 5.0 database, with java version "1.6.0".

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.remove(Unknown Source)
at org.hibernate.tool.hbm2x.DocExporter.generatePackageSummary(DocExporter.java:386)
at org.hibernate.tool.hbm2x.DocExporter.doStart(DocExporter.java:161)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate$1.execute(CodeGenerationLaunchDelegate.java:257)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:89)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.runExporters(CodeGenerationLaunchDelegate.java:228)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:130)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:639)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:565)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:754)
at org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlugin.java:944)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)



Any indication would be of great help.

Thanks and Regards,


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 29, 2007 8:54 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
Do you mean revenge? Try using the ant task instead it's a lot easier to get working and keep working...
here's mine for you to look at as an example:
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: Mon Apr 30, 2007 12:07 pm 
Newbie

Joined: Thu Mar 01, 2007 12:27 pm
Posts: 2
Thanks adamgibbons!

Got it working anyways with deleting everything and creating Hibernate Console all over again.


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