Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in many to one relation.

 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me fix the problem.
 
Stanley Walker
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone there to help me
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone there who can help me, I provided with all the necessary files.
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The issue has been solved, the POJO class is wrong and the family.hbm file is also wrong. I fixed it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic