Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to insert mock data using Spring Data JPA

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having an awfully difficult time understanding why the following code does not work. I created Author, Book, and Publisher Entity classes. Author can write many books and a book can be written many authors. Publisher can publish many books but a single book can be published by one Publisher (or none). I am getting a error when trying to insert data. If I was just inserting mock data using sql, I would first insert the publisher (because it will have child tables that refer to it), then I would insert either an author, or a book, the order of what I insert first should not matter (but the book needs to have a valid FK).












 
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic