Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: ExporterException with getRef
PostPosted: Wed Feb 22, 2006 11:25 am 
Newbie

Joined: Thu Apr 14, 2005 9:38 am
Posts: 17
Hey,

I've just started using hibernate. I've installed the JBoss ide and updated the hibernate tools to beta 4. I'm trying to reverse engineer a database of one of our old Content Management systems. The problem with this CMS is that the database isn't set up with any PK's of FK's or anything like that, so I have to manually at those to the reveng.xml file.

When I do that and run the reverse engineer, I get this Exception.

Exception while generating code

Reason:
org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException
while processing template doc/tables/table.vm. Invocation of method 'getRef'
in class org.hibernate.tool.hbm2x.doc.DocFileManager threw exception class
java.lang.IllegalArgumentException : To cannot be null.




Hibernate version: 3

Mapping documents:

<hibernate-reverse-engineering>





<table-filter match-name="ARTICLE" />
<table-filter match-name="ASSETPUBLICATION" />
<table-filter match-name="PUBLICATION" />

<table name="ASSETPUBLICATION">
<column name="PUBID" type="big_decimal" />
<column name="ASSETID" jdbc-type='' />
<column name="ASSETTYPE" jdbc-type='' />
<foreign-key foreign-table="ARTICLE">
<column-ref local-column="ID" foreign-column="ASSETID" />
</foreign-key>
</table>
<table name="PUBLICATION">
<column name="PUBROOT" jdbc-type='' />
<column name="DESCRIPTION" jdbc-type='' />
<column name="NAME" jdbc-type='' />
</table>
<table name="ARTICLE">
<primary-key>
<column name="ID" jdbc-type='' type="big_decimal" />
</primary-key>
<column name="EDITORSNOTES" jdbc-type='' />
<column name="TRANSMISSIONDATE" jdbc-type='' />
<column name="BYLINE" jdbc-type='' />
<column name="SUBHEADLINE" jdbc-type='' />
<column name="CATEGORY" jdbc-type='' />
<column name="COPYRIGHT" jdbc-type='' />
<column name="ENDDATE" jdbc-type='' />
<column name="KEYWORD" jdbc-type='' />
<column name="WORKFLOWID" jdbc-type='' />
<column name="URLBODY" jdbc-type='' />
<column name="SOURCE" jdbc-type='' />
<column name="UPDATEDDATE" jdbc-type='' />
<column name="STATUS" jdbc-type='' />
<column name="SUBTYPE" jdbc-type='' />
<column name="UPDATEDBY" jdbc-type='' />
<column name="CREDITLINE" jdbc-type='' />
<column name="CREATEDBY" jdbc-type='' />
<column name="TEMPLATE" jdbc-type='' />
<column name="ABSTRACT" jdbc-type='' />
<column name="BODY" jdbc-type='' />
<column name="CREATEDDATE" jdbc-type='' />
<column name="DESCRIPTION" jdbc-type='' />
<column name="PATH" jdbc-type='' />
<column name="NAME" jdbc-type='' />
<column name="FILENAME" jdbc-type='' />
<column name="STARTDATE" jdbc-type='' />
<column name="SUGGESTION" jdbc-type='' />
<column name="LINKTEXT" jdbc-type='' />
</table>
</hibernate-reverse-engineering>


Name and version of the database you are using:

Oracle 8.1.4


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 22, 2006 12:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
reduce it to a minimal testcase and put it in jira.

workaround: don't run the doc exporter ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 03, 2008 9:11 am 
Newbie

Joined: Mon Dec 10, 2007 7:03 am
Posts: 14
I still have this problem with hbm2doc bundled in Hibernate Tools3.2.4beta1 (with Hibernate 3.2.6 and Oracle 10.2).

I am using JPA annotations, how can I know which class raises the problem?

Stack trace
Code:
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:
Code:
   <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>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 03, 2008 10:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
Did you report it in jira ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 03, 2008 11:55 am 
Newbie

Joined: Mon Dec 10, 2007 7:03 am
Posts: 14
Not yet but I can...

I have noticed that the template generates some files (hbm2doc\tables\default\MY_TABLE.html) before exiting with this exception. I thing there is something in one Entity that makes Hbm2Doc fail. But I don't known which Entity/Table is the culprit. All my entities have been tested (runtime execution): the O/R mapping is correct.

Thanks for your help


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 03, 2008 12:15 pm 
Newbie

Joined: Mon Dec 10, 2007 7:03 am
Posts: 14
Here it is:
http://opensource.atlassian.com/project ... e/HBX-1094


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.