The hbm2java task throws an exception when running this task for Hibernate Tools 3.1Beta2. This task used to work for Hibernate Tools 3.1.0 alpha4 and alpha5 and Eclipse 3.1.0.
I was upgrading Eclipse from version 3.1.0 to 3.1.1 (Web Tools Project all-in-one build). I started with a clean Eclipse 3.1.1 installation. Then I installed the Hibernate Tools 3.1 Beta2 plugin. When I ran the "codegen" target in the DAO project build.xml, the hbm2java task errored out.
Code:
Buildfile: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\ant\build.xml
init:
cleangen:
[delete] Deleting directory C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to
copyhbm:
[echo] middlegen.gen-src = c:\projects\aviva\vss\autoge~1\4build~1\workspace\middlegen\autogen\build\gen-src
[copy] Copying 16 files to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src
update-mapping-version:
[mkdir] Created dir: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml
[xslt] Transforming into C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\AppConfigRefTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\AppConfigRefTO.hbm.xml
[xslt] Loading stylesheet C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\util\xml\HibernateMapping3.0DOCTYPE.xsl
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\AttachmentTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\AttachmentTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\AwdConfigRefTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\AwdConfigRefTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ContractRequestTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\ContractRequestTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ErrorCodeRefTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\ErrorCodeRefTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ErrorLogTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\ErrorLogTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ExtractTypeRefTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\ExtractTypeRefTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\IllustrationStateRefTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\IllustrationStateRefTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\InputBatchTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\InputBatchTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\OutputTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\OutputTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\PlanCodeRefTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\PlanCodeRefTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\PrintBatchTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\PrintBatchTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ProductGroupRefTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\ProductGroupRefTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ProductTypeRefTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\ProductTypeRefTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\StatusRefTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\StatusRefTO.hbm.xml
[xslt] Processing C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\TypeRefTO.hbm.xml to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml\TypeRefTO.hbm.xml
[delete] Deleting directory C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to
[copy] Copying 16 files to C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to
[delete] Deleting directory C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\xml
hbm2java:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] - Hibernate 3.0.5
[hibernatetool] - loaded properties from resource hibernate.properties: {hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.jndi.class=com.sun.jndi.fscontext.RefFSContextFactory, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.cache.region_prefix=hibernate.test, hibernate.proxool.pool_alias=pool1, hibernate.jdbc.batch_size=0, hibernate.jndi.url=file:/, hibernate.jdbc.use_streams_for_binary=true, hibernate.max_fetch_depth=1, hibernate.session_factory_name=java:/hibernate/HibernateFactory, hibernate.connection.pool_size=1, hibernate.connection.username=autogen, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=org.hibernate.dialect.Oracle9Dialect, hibernate.connection.url=jdbc:oracle:oci8:@AVIVA}
[hibernatetool] - using java.io streams to persist binary types
[hibernatetool] - using CGLIB reflection optimizer
[hibernatetool] - using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\AppConfigRefTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.AppConfigRefTO -> APP_CONFIG_REF
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\AttachmentTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.AttachmentTO -> ATTACHMENT
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\AwdConfigRefTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.AwdConfigRefTO -> AWD_CONFIG_REF
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ContractRequestTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.ContractRequestTO -> CONTRACT_REQUEST
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ErrorCodeRefTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.ErrorCodeRefTO -> ERROR_CODE_REF
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ErrorLogTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.ErrorLogTO -> ERROR_LOG
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ExtractTypeRefTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.ExtractTypeRefTO -> EXTRACT_TYPE_REF
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\IllustrationStateRefTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.IllustrationStateRefTO -> ILLUSTRATION_STATE_REF
[hibernatetool] - Could not perform validation checks for component as the class com.avivausa.autogen.model.to.IllustrationStateRefTOPK was not found
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\InputBatchTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.InputBatchTO -> INPUT_BATCH
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\OutputTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.OutputTO -> OUTPUT
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\PlanCodeRefTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.PlanCodeRefTO -> PLAN_CODE_REF
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\PrintBatchTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.PrintBatchTO -> PRINT_BATCH
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ProductGroupRefTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.ProductGroupRefTO -> PRODUCT_GROUP_REF
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\ProductTypeRefTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.ProductTypeRefTO -> PRODUCT_TYPE_REF
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\StatusRefTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.StatusRefTO -> STATUS_REF
[hibernatetool] - Mapping file: C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\gen-src\com\avivausa\autogen\model\to\TypeRefTO.hbm.xml
[hibernatetool] - Mapping class: com.avivausa.autogen.model.to.TypeRefTO -> TYPE_REF
[hibernatetool] - processing extends queue
[hibernatetool] - processing collection mappings
[hibernatetool] - Mapping collection: com.avivausa.autogen.model.to.ContractRequestTO.attachments -> ATTACHMENT
[hibernatetool] - Mapping collection: com.avivausa.autogen.model.to.InputBatchTO.contractRequests -> CONTRACT_REQUEST
[hibernatetool] - Mapping collection: com.avivausa.autogen.model.to.PlanCodeRefTO.illustrationStateRefs -> ILLUSTRATION_STATE_REF
[hibernatetool] - Mapping collection: com.avivausa.autogen.model.to.PrintBatchTO.contractRequests -> CONTRACT_REQUEST
[hibernatetool] - Mapping collection: com.avivausa.autogen.model.to.ProductGroupRefTO.productTypeRefs -> PRODUCT_TYPE_REF
[hibernatetool] - Mapping collection: com.avivausa.autogen.model.to.ProductTypeRefTO.planCodeRefs -> PLAN_CODE_REF
[hibernatetool] - processing association property references
[hibernatetool] - processing foreign key constraints
[hibernatetool] - **************************************************************
[hibernatetool] - Starting Jakarta Velocity v1.4
[hibernatetool] - RuntimeInstance initializing.
[hibernatetool] - Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
[hibernatetool] - Trying to use logger class org.apache.velocity.tools.generic.log.CommonsLogLogSystem
[hibernatetool] - Using logger class org.apache.velocity.tools.generic.log.CommonsLogLogSystem
[hibernatetool] - Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[hibernatetool] - Resource Loader Instantiated: org.apache.velocity.runtime.resource.loader.FileResourceLoader
[hibernatetool] - FileResourceLoader : initialization starting.
[hibernatetool] - FileResourceLoader : adding path '.'
[hibernatetool] - FileResourceLoader : initialization complete.
[hibernatetool] - Resource Loader Instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] - ClasspathResourceLoader : initialization starting.
[hibernatetool] - ClasspathResourceLoader : initialization complete.
[hibernatetool] - ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
[hibernatetool] - Default ResourceManager initialization complete.
[hibernatetool] - Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[hibernatetool] - Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[hibernatetool] - Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[hibernatetool] - Loaded System Directive: org.apache.velocity.runtime.directive.Include
[hibernatetool] - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[hibernatetool] - Created: 20 parsers.
[hibernatetool] - Velocimacro : initialization starting.
[hibernatetool] - Velocimacro : allowInline = true : VMs can be defined inline in templates
[hibernatetool] - Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
[hibernatetool] - Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
[hibernatetool] - Velocimacro : messages on : VM system will output logging messages
[hibernatetool] - Velocimacro : autoload off : VM system will not automatically reload global library macros
[hibernatetool] - Velocimacro : initialization complete.
[hibernatetool] - Velocity successfully started.
[hibernatetool] - ResourceManager : found pojo/Pojo.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] - ResourceManager : found pojo/PojoTypeDeclaration.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] - ResourceManager : found pojo/Ejb3TypeDeclaration.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] - ResourceManager : found pojo/PojoFields.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] - ResourceManager : found pojo/PojoConstructors.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] - Method needsMinimalConstructor threw exception for reference $pojo in template pojo/PojoConstructors.vm at [7,6]
[hibernatetool] - Method get threw exception for reference $templates in template pojo/Pojo.vm at [12,1]
BUILD FAILED
C:\Projects\Aviva\VSS\AutoGen Contracts Implementation\4 Build\workspace\DAO\ant\build.xml:120: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template Pojo. Invocation of method 'get' in class org.hibernate.tool.hbm2x.TemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/PojoConstructors.vm. Invocation of method 'needsMinimalConstructor' in class org.hibernate.tool.hbm2x.pojo.EntityPOJOClass threw exception class java.lang.NoSuchMethodError : org.hibernate.mapping.Property.getGeneration()Lorg/hibernate/mapping/PropertyGeneration;
Total time: 37 seconds