Hi,
Any help here would be greatly appreciated. I am trying to reverse-engineer, using hbm2hbmxml, a postgres database using Maven Hibernate 3 plugin or Ant's Hibernate tool and getting the following error:
Caused by: org.xml.sax.SAXParseException: Attribute "cascade" must be declared for element type "many-to-one".
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.addDTDDefaultAttrsAndValidate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(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.reveng.OverrideRepository.addInputStream(OverrideRepository.java:142)
... 25 more
The culprid is my hibernate.reveng.xml file when I try to define a cascade. below is a copy of my hibernate.reveng.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<schema-selection match-schema="" match-table="abc_.*" />
<table schema="public" name="abc_customer" class="abc.Customer">
<primary-key>
<generator class="abc.sequence.CustomerSequence">
<param name="sequence">Customer Sequence</param>
<param name="parameters">start with 5000000 increment by 1 cache 20</param>
</generator>
<key-column name="customer_id" property="key"/>
</primary-key>
<foreign-key constraint-name="phone1" foreign-table="abc_phone">
<column-ref local-column="phone1_id" foreign-column="phone_id"/>
<many-to-one property="phone1" exclude="false" cascade="save-update" />
</foreign-key>
</table>
</hibernate-reverse-engineering>
Below here is a copy of what jar versions are being used:
1. hibernate/ejb3-persistence - 1.0.2.GA
2. hibernate/hibernate-annotations - 3.4.0.GA
3. hibernate/hibernate-commons-annotations - 3.1.0.GA
4. hibernate/hibernate-core - 3.1.0.GA
5. hibernate/hibernate-entitymanager - 3.4.0.GA
6. hibernate/hibernate-parent - 3.3.1.GA
7. hibernate/hibernate-tools - 3.2.3.GA
8. hibernate/jtidy - 48-20060801
I read in that there was fixe in a prior release (
http://opensource.atlassian.com/project ... issue-tabs), but appears that the current DTD file does not support this.
Thank you for your help,
R