Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
[<!ENTITY ekkoProperty SYSTEM "ekko_property.xml" >]
>
<hibernate-mapping
package="com.ekkosoftware.cc.domain">
<class
name="EkkoPropertyValue"
table="property_values"
proxy="EkkoPropertyValue"
entity-name="ControlPropertyValue"
>
&ekkoProperty;
</class>
<class
name="EkkoPropertyValue"
table="test_property_values"
proxy="EkkoPropertyValue"
entity-name="TestPropertyValue"
>
&ekkoProperty;
</class>
</hibernate-mapping>
ekko_property.xml:
<id
name="id"
type="int"
column="PropertyValueID"
>
<generator class="native" />
</id>
<discriminator
column="PropertyType"
type="string"
/>
<many-to-one
name="ekkoProperty"
column="EkkoPropertyID"
class="EkkoProperty"
lazy="false"
fetch="join"
outer-join="true"
/>
<many-to-one
name="ekkoEntity"
column="EntityID"
class="EkkoEntity"
lazy="true"
/>
<subclass name="IntPropertyValue"
discriminator-value="Int"
>
<property name="value"
type="int"
column="IntValue"
></property>
</subclass>
<subclass name="StringPropertyValue"
discriminator-value="String"
>
<property name="value"
type="string"
column="StringValue"
></property>
</subclass>
<subclass name="DatePropertyValue"
discriminator-value="Date"
>
<property name="value"
type="timestamp"
column="DateValue"
></property>
</subclass>
Hi there,
I'm having a problem including an xml file in one of my mapping files using the [!ENTITY xmlEntityName SYSTEM "filename">] syntax in the doctype element.
The app is a java web app running in Tomcat and the creation of the SessionFactory is handled by a static block of the the HibernateUtil class.
When I start tomcat i get the following exception:
org.hibernate.MappingException: Could not read mappings from resource: com/ekkosoftware/cc/domain/EkkoPropertyValue.hbm.xml
which is caused by:
org.dom4j.DocumentException: C:\jakarta-tomcat-5.5.9\bin\ekko_property.xml (The system cannot find the file specified) Nested exception: C:\jakarta-tomcat-5.5.9\bin\ekko_property.xml (The system cannot find the file specified)
Why is Hibernate looking in the tomcat bin directory for the ekko_propery.xml file rather then in the directory which contains the EkkoPropertyValue.hbm.xml file? Obviously i can't hard code the path to the ekko_property.xml file so what do i do?
I'm assuming that this is something to do with classloaders, I thought initially that maybe the parser that hibernate is using to read the mapping files has been loaded by the Tomcat system classloader rather then the web app context classloader, but I'm not really sure how to resolve the issue.
Does anyone have any ideas?
Tom