This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes could not parse mapping resource. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "could not parse mapping resource. " Watch "could not parse mapping resource. " New topic
Author

could not parse mapping resource.

Arun Seshadri
Greenhorn

Joined: Dec 22, 2005
Posts: 18
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

Joined: Dec 11, 2006
Posts: 364
What does your Deals class look like?
Apparently, Hibernate stops at the RESULT_ID property.
Arun Seshadri
Greenhorn

Joined: Dec 22, 2005
Posts: 18
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

Joined: Dec 11, 2006
Posts: 364
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

Joined: Dec 22, 2005
Posts: 18
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

Joined: Dec 11, 2006
Posts: 364
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: could not parse mapping resource.