Hello everybody!
I am having a problem in mapping document.
I don't know where I am doing wrong.
Its urgent! please help.
According to me each element in mapping file is correct, but even then invalid mapping exception is comming.
Question class have description(desc property), multiple answer options(many-to-many element), and one correct answer(many-to-one element).
Answer class have description(desc property), and long description(longDesc) property
Hibernate version: 3.0
Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Question" table="question">
<id name="questionId" column="question_id" type="int" unsaved-value="null">
<generator class="native"/>
</id>
<property name="desc" />
<map name="options" table="answer_option">
<key column="question_id" />
<index column="option_name" type="string" />
<many-to-many column="option_id" class="Answer" />
</map>
<many-to-one name="answer" class="Answer" column="answer_id" />
</class>
<class name="Answer" table="answer">
<id name="answerId" column="answer_id" type="int" unsaved-value="null">
<generator class="native" />
</id>
<property name="desc" type="string" length="20" />
<property name="longDesc" column="long_desc" type="string" />
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource onlinetest/hibernate/exam/Question.hbm.xml
Name and version of the database you are using: DB2 v-8.1
Server: Tomcat 5.0