• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

could not parse mapping resource.

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic