• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

136
Views
Error al insertar en tabla relacional muchos a muchos

Estoy tratando de conservar los datos relacionales en la base de datos myql con typeORM y nestjs, pero aparentemente muestra un error en la base de datos.

Entidad:

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

Servicio:

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

Error:

ERROR [ExceptionsHandler] No se puede agregar o actualizar una fila secundaria: una restricción de clave externa falla ( stocksystem . stock_seals_seals , CONSTRAINT FK_70140d58e95fbceed988b224e64 FOREIGN KEY ( stockId ) REFERENCES stock ( id ) ON DELETE CASCADE ON UPDATE CASCADE)

Carga útil:

 {"client":{"id":1},"stock":[{"id":1},{"id":1}],"price":398}
about 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error