• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

java.sql.SQLException: Cannot add or update a child row: a foreign key constraint fails

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Could someone help me understand that why am I getting the following error when I am trying to persist ServiceProvider entity?


The situation is like this: a ServiceProvider has a List of BusinessLocation and a State has a list of BusinessLocation.

Following annotated classes that I want to be persisted:
ServiceProvider.java


BusinessLocation,java



Looking forward to someone waking me up of the blunder I might be commiting here.
Thanks.
 
Rohit Bhal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I've got this problem resolved. The blunder that I was committting was that I was trying to override the automatically generated IDs by Hibernate.
Thanks
 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic