spring-petclinic / spring-framework-petclinic

A Spring Framework application based on JSP, Spring MVC, Spring Data JPA, Hibernate and JDBC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

new functionality remove pet from specific owner

rojas1995 opened this issue · comments

Hi, I'm trying to add this functionality for a class job.
I remove one pet of the list of pets for one owner, save the owner and later delete the pet. This is the way I'm trying to do it, but throw a this SQL exception:

[WARNING] SQL Error: -10, SQLState: 23502
[ERROR] violación del restricción de integridad: restricción ('check') NOT NULL; SYS_CT_10117 table: PETS column: OWNER_ID
[ERROR] HHH000346: Error during managed flush [org.hibernate.exception.ConstraintViolationException: could not execute statement]
[WARNING] Resolved [org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement]

Any recommendations to add this functionality, or solve this problem, or documentation?

Hi @rojas1995. Do you have the corresponding unit test?

Hi @rojas1995. Do you have the corresponding unit test?

When I read your comment I did the test, and by doing tests I changed the way I did it and now it works.
Thanks for your answer.