Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

could not parse mapping resource.

 
Arun Seshadri
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am new to Hibernate and trying to map a hbm.xml file but for some reason I get this error
"Could not parse mapping document from resource deals.hbm.xml"

The following is the dump of events that I get on log4j on eclipse when I try to run the code. Could someone please let me know where I am going wrong?



The mapping deals.hbm.xml file looks like the one below.

 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your Deals class look like?
Apparently, Hibernate stops at the RESULT_ID property.
 
Arun Seshadri
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The deals class looks like the following.



The project structure under Eclipse is

hibernateexample
+ bin
+ roseindia/tutorial/Hibernate/ (All class files here)
deals.hbm.xml file here
hibernate.cfg.xml file here
+ src
+ roseindia/tutorial/hibernate

I tried to run the code now and I get this error.

 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Arun Seshadri:

I tried to run the code now and I get this error.



By "now", do you mean "after having commented out the package statement"?
The version you referred to in your original post was closer to working code; you need to return to that one and modify the mapping element at which Hibernate stopped:



The property name should be the name of the field in the Deals class, which is ResultID (case sensitive).
 
Arun Seshadri
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes after commenting out the package statement it seems to be doing something but there are still some errors.

I have changed the hbm.xml file as per your suggestion and I corrected the ResultID field in the XML document. When I execute the code I am getting the following error message.





 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the output that I see, the parsing issue is resolved, and the program works. Whether it works as intended is a different question, and I suggest a different thread for discussing it if needed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic