-->
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.  [ 3 posts ] 
Author Message
 Post subject: hbm2doc: HTML not supported in table comments
PostPosted: Tue Jan 15, 2008 6:57 am 
Newbie

Joined: Tue Jan 15, 2008 6:16 am
Posts: 4
Location: Rotterdam, NL
I have successfully used hbm2doc to generate HTML documentation for the relational database schema that we generated from our annotated entity classes. This is useful because you can specify table descriptions for each table, so you end up with Javadoc-style documentation.

However, I would like to be able to HTML in the table comment like you can in Javadoc, for when I have several paragraphs, lists, or links. For example:

Code:
@org.hibernate.annotations.Table(appliesTo = "order_component", comment = "A customer order, usually a <a href=\"http://en.wikipedia.org/wiki/Sales_order\">sales order</a>")


However, this results in a hibernate-mapping file with a class element that contains:

Code:
<comment>A customer order, usually a <a href="http://en.wikipedia.org/wiki/Sales_order">sales order</a></comment>


which breaks the mapping file. I think it is reasonable that the text content of the comment should be HTML-encoded. Did I miss something?

It would be nice if the hbm2doc tool would then decode HTML entities when inserting the content in the generated HTML documentation, allowing much prettier documentation.

_________________
Hibernate 3.2.5.GA, Hibernate EntityManager-3.3.1.GA, Hibernate Search 3.0.0.beta3, Hibernate Tools 3.2.0.CR1, PostgreSQL 8.2.5


Top
 Profile  
 
 Post subject: error message
PostPosted: Tue Jan 15, 2008 7:18 am 
Newbie

Joined: Tue Jan 15, 2008 6:16 am
Posts: 4
Location: Rotterdam, NL
I forgot to mention, the example above generates the following errors on application deployment, in case anyone else was wondering what causes this:

Quote:
12:13:17,763 ERROR [org.hibernate.util.XMLHelper] Error parsing XML: XML InputStream(8) Element type "a" must be declared.
12:13:17,763 ERROR [org.hibernate.util.XMLHelper] Error parsing XML: XML InputStream(8) The content of element type "comment" must match "null".
12:13:17,765 WARN [org.jboss.system.ServiceController] Problem starting service persistence.units:ear=myapp.ear,jar= myapp.jar,unitName= myapp
org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:729)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:963)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:792)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:416)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
...
Caused by: org.xml.sax.SAXParseException: Element type "a" must be declared.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:725)
... 102 more

_________________
Hibernate 3.2.5.GA, Hibernate EntityManager-3.3.1.GA, Hibernate Search 3.0.0.beta3, Hibernate Tools 3.2.0.CR1, PostgreSQL 8.2.5


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 15, 2008 10:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
provide a patch that solves it in jira and we can look at integrating it.

_________________
Max
Don't forget to rate


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