my dog learned polymorphism*
The moose likes Object Relational Mapping and the fly likes Hibernate many-to-one mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate many-to-one mapping" Watch "Hibernate many-to-one mapping" New topic
Author

Hibernate many-to-one mapping

srikanth sridhar
Greenhorn

Joined: Dec 17, 2011
Posts: 15
Hi,

I have problem in hibernate mapping.
The two tables are

MEAL ON BOARD - master tables

while updating getting
Caused by: java.sql.BatchUpdateException: ORA-02291: integrity constraint (FK_OPRS_SERVICES_MEAL_02) violated - parent key not found

My HBM mapping is as follows

I tried many to one mapping but failing miserably. Please help.....
srikanth sridhar
Greenhorn

Joined: Dec 17, 2011
Posts: 15
sorry the OPRS_SERVICES_MEAL has error

the corrected one
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3833

I tried many to one mapping but failing miserably.

Where? You have shown only partial mapping. You need to tell more details here (TellTheDetails). Where is "FK_OPRS_SERVICES_MEAL_02" is defined?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
srikanth sridhar
Greenhorn

Joined: Dec 17, 2011
Posts: 15
"FK_OPRS_SERVICES_MEAL_02" is defined in the Serviced Master Table
The table is


I tred mapping this way
 
GeeCON Prague 2014
 
subject: Hibernate many-to-one mapping