This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 3817

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate many-to-one mapping
 
Similar Threads
how to insert a current date into the databse colunm using hybernate ?
HibernateException - Wrong column type
retrieving object hierarchy - many-to-one?
Looking for a database to Java code generator
Hibernate parent/child and foreign key relationships mapping