-->
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.  [ 2 posts ] 
Author Message
 Post subject: hbm2ddl error with relative xml entity
PostPosted: Mon Oct 04, 2004 11:13 pm 
Newbie

Joined: Mon Oct 04, 2004 2:07 pm
Posts: 3
I already posted this question under tools, but I made a mistake in my posting and I thought I might have put it under the wrong section so I figured I'd give it another shot.

I'm relatively new to hibernate and its tools. I'm trying to use an xml entity to move a component into a file that can be shared by a number of different mapping files.

I've included below a mapping file and a component file. When I use this setup with the hbm2java tool, it correctly pulls in the relative component file. However when I try to do a hbm2ddl I get an error saying that it doesn't know how to find the relative uri because there is no base uri defined. I was hoping that I could find everything relative to the base mapping file that is being processed. Please let me know if I should be looking relative to a different directory and if so is there some way to make the hbm2java and the hbm2ddl work off of the same mapping files.

Mapping documents:
ContingencyExpiration.hbm.xml (Mapping File)
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" [
    <!ENTITY Contingency SYSTEM "components/hsos.contingency.persistence.Contingency.xml">
]
>

   
<hibernate-mapping>

<class
    name="com.imi.hsos.reference.persistence.ContingencyExpiration"
    table="IMIHS_CONTINGENCY_EXPIRATION_T"
>

    <composite-id name="comp_id" class="com.imi.hsos.reference.persistence.ContingencyExpirationPK">
   <meta attribute="default-value">new com.imi.hsos.reference.persistence.ContingencyExpirationPK()</meta>

   <key-property
      name="ledgerUniqueField"
      column="LEDGER_UNIQUE_FIELD"
      type="java.lang.String"
      length="16"
      >
           <meta attribute="default-value">null</meta>
   </key-property>

   <key-property
      name="ledgerUniqueNbr"
      column="LEDGER_UNIQUE_NBR"
      type="java.lang.String"
      length="8"
      >
      <meta attribute="default-value">null</meta>
   </key-property>
    </composite-id>   

&Contingency;


</class>
</hibernate-mapping>


components/hsos.contingency.persistence.Contingency.xml (Component xml)
Code:
<?xml version='1.0' encoding='UTF-8'?>

<component name="contingency" class="com.imi.hsos.contingency.persistence.Contingency">
   <!-- <meta attribute="default-value">new com.imi.hsos.contingency.persistence.Contingency()</meta> -->
   <property
      name="contingencyStartDttm"
      type="java.sql.Timestamp"
      column="CONTINGENCY_START_DTTM"
   />
   <property
      name="contingencyEndDttm"
      type="java.sql.Timestamp"
      column="CONTINGENCY_END_DTTM"
   />
   <property
      name="contingencyDescription"
      type="java.lang.String"
      column="CONTINGENCY_DESCRIPTION"
      length="400"
   />
</component>


Error I'm getting:
Code:
[schemaexport] [main] ERROR [] <> - Error parsing XML: XML InputStream(5) Relative URI "components/hsos.contingency.persistence.Contingency.xml"; can not be resolved without a base URI.
[schemaexport] [main] ERROR [] <> - Could not configure datastore from input stream
[schemaexport] org.dom4j.DocumentException: Error on line 5 of document  : Relative URI "components/hsos.contingency.persistence.Contingency.xml"; can not be resolved without a base URI. Nested exception: Relative URI "components/hsos.contingency.persistence.Contingency.xml"; can not be resolved without a base URI.
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:355)
[schemaexport] at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:286)
[schemaexport] at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)
[schemaexport] at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1013)
[schemaexport] at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:969)
[schemaexport] at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:931)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:186)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:301)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)


Ant Task:
Code:
   <target name="schemaexport" depends="init,compile">
      <taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="project.class.path" />
      <schemaexport properties="${commonHS}/resources/hibernate.properties" config="${commonHS}/resources/hibernate.cfg.xml" quiet="no" text="no" drop="no" delimiter=";" output="${commonHS}/schema-export.sql">

      </schemaexport>
   </target>


Hibernate version: 2.1.6

Tool jar: hibernate-tools-2.1.2.jar

Database: Oracle 9i


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 11:23 am 
Newbie

Joined: Thu Aug 25, 2005 5:43 am
Posts: 2
Hi krossche,
we got the same problem, have you solved it?

Greets,
martin


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