SOLVED: I ignored warnings about primary keys that were missing. After fixing those warnings it worked.
I am running a fresh install of Eclipse 3.1.2 and Hibernate tools 3.1.0.beta5.
I made the appropriate files for reverse engineering.
Under Hibernate Code Generation -> Exporters I checked: Use Java 5 syntax, Generate EJB3 annotations, Domain code.
When I try to reverse engineer I get the following error message:
Code:
Error 2006-06-19 12:39:10.125 ERROR Worker-14 freemarker.runtime -
Method public java.lang.String org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateAnnTableUniqueConstraint() threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(no.deltasoft.deltatotal.etel.Talign)
The problematic instruction:
----------
==> ${pojo.generateAnnTableUniqueConstraint()} [on line 13, column 29 in pojo/Ejb3TypeDeclaration.ftl]
in include "Ejb3TypeDeclaration.ftl" [on line 4, column 1 in pojo/PojoTypeDeclaration.ftl]
in include "PojoTypeDeclaration.ftl" [on line 5, column 1 in pojo/Pojo.ftl]
----------
Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateAnnTableUniqueConstraint() threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(no.deltasoft.deltatotal.etel.Talign)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.visit(Environment.java:233)
at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:231)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:243)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:112)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:101)
at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:84)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:69)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:93)
at org.hibernate.tool.hbm2x.GenericExporter.start(GenericExporter.java:59)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate$1.execute(CodeGenerationLaunchDelegate.java:250)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.runExporters(CodeGenerationLaunchDelegate.java:221)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:108)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:590)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:515)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:733)
at org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlugin.java:931)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Caused by: java.lang.NullPointerException
at org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateAnnTableUniqueConstraint(EntityPOJOClass.java:177)
at org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateAnnTableUniqueConstraint(EntityPOJOClass.java:166)
at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:583)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
... 52 more
If I instead checked: Use Java 5 syntax, Domain code, Hibernate xml mappings it works.
I am not experienced enough in Eclipse or with the Hibernate tools to know what could be causing this error.
Thanks in advance for any help :)