Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
Error when inserting into relational table many to many

I'm trying to persist relational data in myql database with typeORM and nestjs but it's showing an error apparently in the database

Entity:

  @ManyToMany(()=> Stock, stock => stock.seals)
  @JoinTable()
  stock: Stock[];

Service:

var c = getConnection().getRepository(Seals).save(createSealDto)
     return c 

Error:

ERROR [ExceptionsHandler] Cannot add or update a child row: a foreign key constraint fails (stocksystem.stock_seals_seals, CONSTRAINT FK_70140d58e95fbceed988b224e64 FOREIGN KEY (stockId) REFERENCES stock (id) ON DELETE CASCADE ON UPDATE CASCADE)

Payload:

{"client":{"id":1},"stock":[{"id":1},{"id":1}],"price":398}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!