-->
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: hbm2ddl a relative file to define an xml entity
PostPosted: Mon Oct 04, 2004 2:45 pm 
Newbie

Joined: Mon Oct 04, 2004 2:07 pm
Posts: 3
I'm relatively new to hibernate and its tools. I'm trying to use an xml element to move components
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.

here's the ant definition of my hbm2ddl:
<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>


I'm using hibernate-tools-2.1.2.jar

Hibernate version:2.1.6

Mapping documents:

components/hsos.contingency.persistence.Contingency.xml
<?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"
/>
</component>

<?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 "C:\Development\Stanford\handson\HScommon\resources\components\hsos.contingency.persistence.Contingency.xml">
]
>

ContingencyExpiration.hbm.xml
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin

http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->

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

&Contingency;
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
schemaexport:
[schemaexport] [main] WARN [] <> - Ignore this warning outside Tomcat. Can't get resource hibernate.cfg.xml.
[schemaexport] [main] ERROR [] <> - Error parsing XML: XML InputStream(5) Relative URI "C:\Development\Stanford\handson\HScommon\resources\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 "C:\Development\Stanford\handson\HScommon\resources\components\hsos.contingency.persistence.Contingency.xml"; can not be resolved without a base URI. Nested exception: Relative URI "C:\Development\Stanford\handson\HScommon\resources\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)
[schemaexport] Nested exception:
[schemaexport] org.xml.sax.SAXParseException: Relative URI "C:\Development\Stanford\handson\HScommon\resources\components\hsos.contingency.persistence.Contingency.xml"; can not be resolved without a base URI.
[schemaexport] at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)
[schemaexport] at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3370)
[schemaexport] at org.apache.crimson.parser.Parser2.resolveURI(Parser2.java:2952)
[schemaexport] at org.apache.crimson.parser.Parser2.maybeExternalID(Parser2.java:2924)
[schemaexport] at org.apache.crimson.parser.Parser2.maybeEntityDecl(Parser2.java:2826)
[schemaexport] at org.apache.crimson.parser.Parser2.maybeMarkupDecl(Parser2.java:1390)
[schemaexport] at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1324)
[schemaexport] at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:656)
[schemaexport] at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
[schemaexport] at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:339)
[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)
BUILD FAILED: C:\Development\Stanford\handson\nickBuild.xml:85: Schema text failed: Error reading resource: ContingencyExpiration.hbm.xml


Name and version of the database you are using:Oracle 9i


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.