I am new to hibernate and i am having trouble with specifying the location of the mapping file in hibernate.cfg.xml file.
I have created an Event object in org.hibernate.tutorial.chapter1.domain.Event.java package with its corresponding Event.hbm.xml file in the same location.
I am trying to specify the location in the hibernate.cfg.xml mapping tag but I am getting an InvalidMappingException ().
I have added to the post: the exception, the mapping from the mapping file and the project file structure.
any advice would be great.
484 [main] ERROR org.hibernate.util.xml.ErrorLogger - Error parsing XML (1) : cvc-elt.1: Cannot find the declaration of element 'hibernate-mapping'. 495 [main] ERROR org.hibernate.util.xml.ErrorLogger - Error parsing XML (2) : cvc-elt.1: Cannot find the declaration of element 'hibernate-mapping'. Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Unable to read XML
<!-- Names the annotated entity class -->
<mapping resource="org/hibernate/tutorial/chapter1/domain/Event.hbm.xml"/>
Make sure you have a DOCTYPE in your Event.hbm.xml at the top of the XML content such as:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.hibernate.tutorial.domain">
[...]
</hibernate-mapping>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With