aspose file tools
The moose likes Object Relational Mapping and the fly likes How to specify relationship in mapping file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "How to specify relationship in mapping file" Watch "How to specify relationship in mapping file" New topic
Author

How to specify relationship in mapping file

Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
Hi All
I have the following mapping file in hibernate




where I am trying to specify relationship of quoteId with another quote_detail table but hibernate is throwing an exception saying that duplicate property name specified

Is there any way we can specify these kind of relationships in hibernate
Thanks in advance
:roll:
[ August 10, 2006: Message edited by: Gaurav Chikara ]

SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
Ghulam Rashid
Ranch Hand

Joined: Jan 14, 2002
Posts: 278
Could be please post your other mapping. I remembered I had this problem once, I may look into. Dont use <code> because its difficult to read.
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 504

Originally posted by Ghulam Rashid:
Dont use <code> because its difficult to read.


:roll:


If you are not laughing at yourself, then you just didn't get the joke.
Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
This was my other file


I am putting code because moderator asked me to do so as it retains the formatting
[ August 11, 2006: Message edited by: Gaurav Chikara ]
Ghulam Rashid
Ranch Hand

Joined: Jan 14, 2002
Posts: 278
This is what I understood from your mapping.

QuoteHeaderBO(One)---------------(Many)QuoteDetailBO

If this is what you are trying to map then QuoteHeaderBO.hbm.xml should have collction mapping for holding multiple QuoteDetailBO that we can define using bag,set ... because you have define many-to-one on both xml but you have not define one-to-many (inside bag/set) in QuoteHeaderBO. That could be the reason hibernate might be confusing.

Your mapping for QuoteHeaderBO should look like this.

 
 
subject: How to specify relationship in mapping file
 
Threads others viewed
Hibernate generating queries with duplicate columns
hibernate migration
Hibernate Issue
out of range error
Child record not saved in one-to-many hibernate

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture