-->
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.  [ 1 post ] 
Author Message
 Post subject: <column name="created_date" exclude="true&
PostPosted: Sat Nov 29, 2008 6:45 pm 
Newbie

Joined: Tue Nov 11, 2008 12:36 am
Posts: 14
I am attempting to user Hibernate Tools to generate mapping file and pojos from the database via a jdbc configuration. Many of my tables have audit information fields that are maintained by triggers, so I don't want them in the POJO interfaces. The reveng.xml file below causes errors when I try to keep the created_date and modified_date fields out of the mapping.

Code:
<?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-catalog="mmerch"/>

  <!-- these tables or procedures should not be generated -->
  <table-filter match-name="messageprocessing_list" exclude="true" />
  <table-filter match-name="messageprocessing_priority" exclude="true" />
  <table-filter match-name="message_processing_priority" exclude="true" />
  <table-filter match-name="add_message_to_conversation" exclude="true" />
  <table-filter match-name="get_customer_id_from_merchant_and_ref" exclude="true" />
  <table-filter match-name="process_next_message_begin" exclude="true" />
  <table-filter match-name="process_next_message_finalize" exclude="true" />
  <table-filter match-name="reenque_messages_not_finalized" exclude="true" />

  <!-- generate everything else classes -->
  <table-filter match-name=".*">
   <!-- add any global meta attributes for tables here -->
   
   <!-- exclude the audit trail columns, they are handled by triggers -->
   <column name="created_date" exclude="true"/>
   <column name="modified_date" exclude="true"/>
  </table-filter>
 
</hibernate-reverse-engineering>


Here are the errors:
Code:
generate-domain-from-db:
Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
1. task: hbm2hbmxml (Generates a set of hbm.xml files)
An exception occurred while running exporter #2:hbm2hbmxml (Generates a set of hbm.xml files)
To get the full stack trace run ant with -verbose
org.hibernate.MappingException: Could not configure overrides from file: C:\projects\mmerch\trunk\libraries\tribal.lib\src\tribal\domain\hibernate.reveng.xml
org.hibernate.MappingException: invalid override definition
org.xml.sax.SAXParseException: The content of element type "table-filter" must match "(meta)*".
org.hibernate.MappingException: Could not configure overrides from file: C:\projects\mmerch\trunk\libraries\tribal.lib\src\tribal\domain\hibernate.reveng.xml
        at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepository.java:114)
        at org.hibernate.tool.ant.JDBCConfigurationTask.doConfiguration(JDBCConfigurationTask.java:62)
        at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:55)
        at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:302)
        at org.hibernate.tool.ant.HibernateToolTask.getProperties(HibernateToolTask.java:318)
        at org.hibernate.tool.ant.ExporterTask.configureExporter(ExporterTask.java:94)
        at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
        at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:273)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:499)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: org.hibernate.MappingException: invalid override definition
        at org.hibernate.cfg.reveng.OverrideRepository.addInputStream(OverrideRepository.java:143)
        at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepository.java:110)
        ... 23 more
Caused by: org.xml.sax.SAXParseException: The content of element type "table-filter" must match "(meta)*".
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2017)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1772)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2923)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at org.dom4j.io.SAXReader.read(SAXReader.java:465)
        at org.hibernate.cfg.reveng.OverrideRepository.addInputStream(OverrideRepository.java:142)
        ... 24 more
BUILD FAILED (total time: 0 seconds)


If I removed the </column > tags, it generates correctly.

My goal is to remove these two columns from the code generation in a 'global' kind of way, since so many tables use them. I am also generating the mapping files, so I can't just go edit them out of the mapping files. I want to generate mapping files that don't include these columns.

Should this work? Thanks for your help.

_________________
This signature left intentionally blank.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.