This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes One to Many relationship Error. Please guide. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "One to Many relationship Error. Please guide." Watch "One to Many relationship Error. Please guide." New topic
Author

One to Many relationship Error. Please guide.

Ajay Luthria
Greenhorn

Joined: Jul 15, 2009
Posts: 5
I am trying to set one to many relation between a trade and trade details.
One trade object can have multiple trade details and status's.

I am getting the error:

Error reading resource: Trade.hbm.xml

Please suggest if I have overlooked anything?

Thanks a lot and much appreciated for all the help.


Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Remove Trade.hbm.xml from the hibernate.cfg.xml file and see if you get the same error with TradeDetails. I'm wondering if it's just a classpath issue.

-Cameron McKenzie
Ajay Luthria
Greenhorn

Joined: Jul 15, 2009
Posts: 5
Cameron Wallace McKenzie wrote:Remove Trade.hbm.xml from the hibernate.cfg.xml file and see if you get the same error with TradeDetails. I'm wondering if it's just a classpath issue.

-Cameron McKenzie


Hi Cameron,

Tried what you suggested and getting this error now:



It works fine when I comment out TradeDetails.hbm.xml from the Hibernate.cfg.xml and comment out one to many relation from the Trade.hbm.xml
If I run the test harness just on the Trade,the trade is saved in the trade table.....

 
 
subject: One to Many relationship Error. Please guide.
 
Similar Threads
How to insert a new child record only. One to Many Relation.
Why ConstraintViolationException is generated?
Help me for Joinin two tables.
unable to map the hbm files
Looking for a database to Java code generator