-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping Exception
PostPosted: Fri Nov 24, 2006 7:57 am 
Newbie

Joined: Mon Nov 20, 2006 2:12 am
Posts: 8
Location: Gurgaun
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

_________________
Thanks & Regards
Sumit Tyagi.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 8:25 am 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
Please post the stack trace complete

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 8:51 am 
Newbie

Joined: Mon Nov 20, 2006 2:12 am
Posts: 8
Location: Gurgaun
thanks andresgr!!

The problem is solved!!!
It was actually my own silly mistake.
I was using unqualified names of the classes, and hadn't filled the package attribute of hibernate-mapping! In future, I will first of all hunt for such silly mistakes, then post the problems.

and thanks for your concern!!!
Bye!
Take care!

_________________
Thanks & Regards
Sumit Tyagi.


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