aspose file tools*
The moose likes Object Relational Mapping and the fly likes Problem in many to one relation. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem in many to one relation." Watch "Problem in many to one relation." New topic
Author

Problem in many to one relation.

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Hi all, I am facing a problem while trying to insert a record with foreign key.

There are two tables. "Surname" and "Family".

The hibernate files areUsing this code I am trying to insert the recordWhile executing the program I am getting errors like
The table family is created successfully, but error is occurring while insertion.

Can anyone tell me how to fix it? Thank you all in advance.


Love all, trust a few, do wrong to none.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Can anyone help me fix the problem.
Stanley Walker
Ranch Hand

Joined: Sep 23, 2009
Posts: 87
Can you please post the code for the two entity classes which you are using. THere would be more clarity then.
thank you.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

chaitanya karthikk wrote:Hi all, I am facing a problem while trying to insert a record with foreign key.

There are two tables. "Surname" and "Family".

The hibernate files areUsing this code I am trying to insert the recordSurname.javaFamily.javaWhile executing the program I am getting errors like
The table family is created successfully, but error is occurring while insertion.

Can anyone tell me how to fix it? Thank you all in advance.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

anyone there to help me
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Anyone there who can help me, I provided with all the necessary files.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

The issue has been solved, the POJO class is wrong and the family.hbm file is also wrong. I fixed it.
 
 
subject: Problem in many to one relation.