org.postgresql.util.PSQLException: ERROR: update o delete en «person» viola la llave foránea «fked8e89a96dc6e8df» en la tabla «profile» Detail: La llave (id)=(5) todavía es referida desde la tabla «profile».

Spring JIRA | René Vielma | 6 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I created a new roo project and performed the following commands {code:borderStyle=solid} persistence setup --provider HIBERNATE --database POSTGRES --databaseName db --userName user --password pass entity --class ~.domain.Person --testAutomatically field string --fieldName firstName --notNull field string --fieldName lastName --notNull field date --fieldName birthDate --notNull --type java.util.Date entity --class ~.domain.Profile --testAutomatically field string --fieldName username --notNull field string --fieldName password --notNull field reference --fieldName person --notNull --type ~.domain.Person{code} Then I changed the relationship of ManyToOne to OneToOne {code:borderStyle=solid} @NotNull @OneToOne(targetEntity = Person.class) @JoinColumn private Person person;{code} and run 'perform test' which throws : {code:borderStyle=solid}Caused by: org.postgresql.util.PSQLException: ERROR: update o delete en «person» viola la llave foránea «fked8e89a96dc6e8df» en la tabla «profile» Detail: La llave (id)=(5) todavía es referida desde la tabla «profile». at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:321) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2694) ... 52 more Tests run: 9, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.21 sec <<< FAILURE!{code} The error message is correct. The question is why the test crashes if it knows about the integrity constraint? shouldn't the test just give back a notification of a passed integrity test?

    Spring JIRA | 6 years ago | René Vielma
    org.postgresql.util.PSQLException: ERROR: update o delete en «person» viola la llave foránea «fked8e89a96dc6e8df» en la tabla «profile» Detail: La llave (id)=(5) todavía es referida desde la tabla «profile».
  2. 0

    I created a new roo project and performed the following commands {code:borderStyle=solid} persistence setup --provider HIBERNATE --database POSTGRES --databaseName db --userName user --password pass entity --class ~.domain.Person --testAutomatically field string --fieldName firstName --notNull field string --fieldName lastName --notNull field date --fieldName birthDate --notNull --type java.util.Date entity --class ~.domain.Profile --testAutomatically field string --fieldName username --notNull field string --fieldName password --notNull field reference --fieldName person --notNull --type ~.domain.Person{code} Then I changed the relationship of ManyToOne to OneToOne {code:borderStyle=solid} @NotNull @OneToOne(targetEntity = Person.class) @JoinColumn private Person person;{code} and run 'perform test' which throws : {code:borderStyle=solid}Caused by: org.postgresql.util.PSQLException: ERROR: update o delete en «person» viola la llave foránea «fked8e89a96dc6e8df» en la tabla «profile» Detail: La llave (id)=(5) todavía es referida desde la tabla «profile». at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:321) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2694) ... 52 more Tests run: 9, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.21 sec <<< FAILURE!{code} The error message is correct. The question is why the test crashes if it knows about the integrity constraint? shouldn't the test just give back a notification of a passed integrity test?

    Spring JIRA | 6 years ago | René Vielma
    org.postgresql.util.PSQLException: ERROR: update o delete en «person» viola la llave foránea «fked8e89a96dc6e8df» en la tabla «profile» Detail: La llave (id)=(5) todavía es referida desde la tabla «profile».
  3. 0

    geonetwork: error updating local user

    GitHub | 3 years ago | fvanderbiest
    org.postgresql.util.PSQLException: ERROR: value too long for type character varying(16)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    geonetwork: phone field too short in user table

    GitHub | 4 years ago | fvanderbiest
    org.postgresql.util.PSQLException: ERROR: value too long for type character varying(16)
  6. 0

    Spring Roo, JPA. Cascade issue. Delete on table violates foreign key constraint

    Stack Overflow | 5 years ago | user527154
    org.postgresql.util.PSQLException: ERROR: update or delete on table "reo" violates foreign key constraint "fk993583fceeb2fb9e" on table "description" Detail: Key (id)=(47) is still referenced from table "description".

  1. silex 5 times, last 3 months ago
20 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.postgresql.util.PSQLException

    ERROR: update o delete en «person» viola la llave foránea «fked8e89a96dc6e8df» en la tabla «profile» Detail: La llave (id)=(5) todavía es referida desde la tabla «profile».

    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse()
  2. PostgreSQL JDBC Driver
    AbstractJdbc2Statement.executeUpdate
    1. org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
    2. org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
    3. org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
    4. org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
    5. org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
    6. org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:321)
    6 frames
  3. Commons DBCP
    DelegatingPreparedStatement.executeUpdate
    1. org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
    1 frame
  4. Hibernate
    AbstractEntityPersister.delete
    1. org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2694)
    1 frame