-->
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.  [ 10 posts ] 
Author Message
 Post subject: hbm2doc error with GraphViz
PostPosted: Tue Jun 19, 2007 12:21 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
I decided to try out the new 3.2.0beta9a version of Hibernate Tools and to try out the hbm2doc with the GraphViz dependency. I am using ANT to execute the tool. When I try to generate the documentation with dot.executable defined to activate the GraphViz diagrams, I get the following error:
Code:
[hibernatetool] Jun 19, 2007 12:00:45 PM freemarker.log.JDK14LoggerFactory$JDK14Logger error
[hibernatetool] SEVERE:
[hibernatetool]
[hibernatetool] Method public java.lang.String org.hibernate.tool.hbm2x.Cfg2HbmTool.getHibernateTypeName(org.hibernate.mapping.Property)
threw an exception when invoked on org.hibernate.tool.hbm2x.Cfg2HbmTool@1abcc03
[hibernatetool] The problematic instruction:
[hibernatetool] ----------
[hibernatetool] ==> if c2h.getHibernateTypeName(property)?exists [on line 62, column 6 in dot/entitygraph.dot.ftl]
[hibernatetool]  in user-directive propertyEdges [on line 32, column 3 in dot/entitygraph.dot.ftl]
[hibernatetool] ----------
[hibernatetool]
[hibernatetool] Java backtrace for programmers:
[hibernatetool] ----------
[hibernatetool] freemarker.template.TemplateModelException: Method public java.lang.String
org.hibernate.tool.hbm2x.Cfg2HbmTool.getHibernateTypeName(org.hibernate.mapping.Property)
threw an exception when invoked on org.hibernate.tool.hbm2x.Cfg2HbmTool@1abcc03
[hibernatetool]         at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
[hibernatetool]         at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
[hibernatetool]         at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
(stack trace trimmed)
[hibernatetool] Caused by: java.lang.UnsupportedOperationException: accept on
org.hibernate.mapping.DependantValue([org.hibernate.mapping.Column(serve_id)])
[hibernatetool]         at org.hibernate.tool.hbm2x.visitor.DefaultValueVisitor.handle(DefaultValueVisitor.java:40)
[hibernatetool]         at org.hibernate.tool.hbm2x.visitor.DefaultValueVisitor.accept(DefaultValueVisitor.java:97)
[hibernatetool]         at org.hibernate.mapping.DependantValue.accept(DependantValue.java:31)
[hibernatetool]         at org.hibernate.tool.hbm2x.Cfg2HbmTool.getHibernateTypeName(Cfg2HbmTool.java:380)
[hibernatetool]         at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
[hibernatetool]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[hibernatetool]         at java.lang.reflect.Method.invoke(Method.java:597)
[hibernatetool]         at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:583)
[hibernatetool]         at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
[hibernatetool]         ... 56 more
[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 template dot/entitygraph.dot.ftl
[hibernatetool] freemarker.template.TemplateModelException: Method public java.lang.String
org.hibernate.tool.hbm2x.Cfg2HbmTool.getHibernateTypeName(org.hibernate.mapping.Property)
threw an exception when invoked on org.hibernate.tool.hbm2x.Cfg2HbmTool@1abcc03
[hibernatetool] java.lang.UnsupportedOperationException: accept on
org.hibernate.mapping.DependantValue([org.hibernate.mapping.Column(serve_id)])

BUILD FAILED
C:\eng\projects\ServeCentral\build.xml:79: org.hibernate.tool.hbm2x.ExporterException: Error while processing template dot/entitygraph.dot.ftl

Anybody have any ideas on how to proceed?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 21, 2007 5:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes, dont use old hibernate jars with hibernate tools ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 21, 2007 7:43 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
max wrote:
yes, dont use old hibernate jars with hibernate tools ;)


OK, I will try 3.2.3 (or whatever it is the latest JBoss is on) at work tomorrow. The versioning has me a little confused however, why are we still on 3.2.0BetaX when they aren't compatible with 3.2.0?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 22, 2007 7:57 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
it is compatible. you just showed an error that could/should only occur on 3.1.x

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 22, 2007 12:22 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
max wrote:
it is compatible. you just showed an error that could/should only occur on 3.1.x


Hmm, that is strange. I tried it with 3.2.3.GA and 3.2.4.sp1 and got the same results. Perhaps something with my ANT configuration is causing me to use an older version - do you know of a way to test that? Is there an ANT task for "which"? Well, that's a little off-topic. I will investigate further.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 22, 2007 12:51 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
OK, I tracked down the <whichresource> task in ANT and I am definitely using the latest:
Code:
schema-doc:
     [echo] jar:file:/P:/Engineering/thirdparty/hibernate/hibernate-3.2.4.sp1/hibernate3.jar!/org/hibernate/mapping/DependantValue.class


Looking at the source the problem seems to be in the HibernateTool. Cfg2HbmTool.getHibernateTypeName() uses a EntityNameFromValueVisitor, which does not override DefaultValueVisitor.accept(DependantValue) which throws an exception.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 22, 2007 2:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmm....please report that in jira with an testcase thanks.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 22, 2007 3:04 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
max wrote:
hmm....please report that in jira with an testcase thanks.


OK, I created an issue (http://opensource.atlassian.com/project ... se/HBX-953). I'm not really well-versed in Hibernate however to the point where I could narrow this down to a simple test case. Maybe you can point me in the right direction, what type of mapping would result in the use of a DependantValue?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 22, 2007 3:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
any association as far as i remember. Possibly one-to-one's.

Try to just take one class at a time and see when the issue occur.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 10:38 am 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
max wrote:
any association as far as i remember. Possibly one-to-one's.

Try to just take one class at a time and see when the issue occur.


I was able to reduce the problem to two classes with a relationship. I attached the mapping to the JIRA ticket and will include it below as well for the curious (also as a sanity check so you can tell me if I am doing something stupid).
Code:
<hibernate-mapping>
    <class name="Foo" table="foo">
        <id name="id" type="java.lang.Integer" unsaved-value="null" >
            <column name="foo_id" sql-type="int" not-null="true" />
            <generator class="native"/>
        </id>
        <list name="bars" table="bar" lazy="false" cascade="all">
              <key column="foo_id" not-null="true"/>
              <list-index column="ordering" />
              <one-to-many class="Bar" />
        </list>
    </class>
    <class name="Bar" table="bar">
        <id name="id" type="java.lang.Integer" unsaved-value="null" >
            <column name="bar_id" sql-type="int" not-null="true" />
            <generator class="native"/>
        </id>
    </class>
</hibernate-mapping>


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