This week's book giveaway is in the Testing forum.
We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line!
See this thread for details.
  • 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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.
 
You've gotta fight it! Don't give in! Read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic