[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1094?page=c...
]
Gérald Quintana commented on HBX-1094:
--------------------------------------
After having looked deeply into the code, I think the problem comes from the following
line in table.ftl
<a href="${docFileManager.getRef(docFile,
docFileManager.getTableDocFile(foreignKey.referencedTable))}"
target="generalFrame">
The problem occurs when the following model:
@Entity
public class A {
@Id
protected int id;
@ManyToOne
protected AbstractB b;
(...)
}
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class AbstractB {
@Id
protected int id;
protected String label;
(...)
}
Since B is abstract and inheritance strategy is "table per class" there is any
"referencedTable" (there are many in fact).
IllegalArgumentException: To cannot be null in DocFileManager.getRef
--------------------------------------------------------------------
Key: HBX-1094
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1094
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2doc
Affects Versions: 3.2.4 Beta1
Environment: Windows, Java 1.6.0_10, Oracle 10.2, Hibernate 3.2.6
Reporter: Gérald Quintana
Running Hbm2Doc on a bunch of JPA annotated Entities, I get and IllegalArgumentException:
To cannot be null in DocFileManager.getRef (see stack trace below).
Some HTML files (\hbm2doc\tables\default\MY_TABLE.html) gets created before Hbm2Doc ends
with this exception. There might be something in one entity code making the table.ftl
FreeMarker template fail. Improving error log could help (which table has a problem?).
Stack trace
hbm2doc:
[hibernatetool] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
[hibernatetool] 1. task: hbm2doc (Generates html schema documentation)
[hibernatetool] log4j:WARN No appenders could be found for logger
(org.hibernate.cfg.annotations.Version).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.
[hibernatetool] An exception occurred while running exporter #2:hbm2doc (Generates html
schema documentation)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.tool.hbm2x.ExporterException: Error while processing
Unknown context with template doc/tables/table.ftl
[hibernatetool] freemarker.template.TemplateModelException: Method public
java.lang.String
org.hibernate.tool.hbm2x.doc.DocFileManager.getRef(org.hibernate.tool.hbm2x.doc.DocFile,org.hibernate.tool.hbm2x.doc.DocFile)
threw an exception when invoked on org.hibernate.tool.hbm2x.doc.DocFileManager@4310d0
[hibernatetool] java.lang.IllegalArgumentException: To cannot be null.
BUILD FAILED
org.hibernate.tool.hbm2x.ExporterException: Error while processing Unknown context with
template doc/tables/table.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:261)
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.DocExporter.processTemplate(DocExporter.java:614)
at org.hibernate.tool.hbm2x.DocExporter.generateTablesDetails(DocExporter.java:415)
at org.hibernate.tool.hbm2x.DocExporter.doStart(DocExporter.java:154)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
(...)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: freemarker.template.TemplateModelException: Method public java.lang.String
org.hibernate.tool.hbm2x.doc.DocFileManager.getRef(org.hibernate.tool.hbm2x.doc.DocFile,org.hibernate.tool.hbm2x.doc.DocFile)
threw an exception when invoked on org.hibernate.tool.hbm2x.doc.DocFileManager@4310d0
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
(...)
at freemarker.template.Template.process(Template.java:232)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:255)
... 26 more
Caused by: java.lang.IllegalArgumentException: To cannot be null.
at org.hibernate.tool.hbm2x.doc.DocFileManager.getRef(DocFileManager.java:466)
(...)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
... 46 more
Ant:
<target name="hbm2doc">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="hibernate.class.path" />
<hibernatetool destdir="target/hibernate3/hbm2doc">
<classpath>(...)</classpath>
<annotationconfiguration
configurationfile="hibernateConfig.xml"/>
<hbm2doc/>
</hibernatetool>
</target>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira