Open PanayiotisCS opened 1 year ago
Dear @jamesagnew
Please let us know if you need any further details, we are happy to provide.
Best Regards Panayiotis Savva
Two things that would be helpful:
Hello @jamesagnew,
I followed the guide according to https://github.com/hapifhir/hapi-fhir-jpaserver-starter as I ran the server via Docker Hub.
After running the docker container with the new empty database I reproduced the following steps:
curl --location --request POST 'http://localhost:8080/fhir/ValueSet' \
--header 'Content-Type: application/json' \
curl --location --request DELETE 'http://localhost:8080/fhir/ValueSet/1' \
--data-raw ''
Response:
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">INFORMATION</td><td>[]</td><td><pre>Successfully deleted 1 resource(s) in 7ms</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [
{
"severity": "information",
"code": "informational",
"diagnostics": "Successfully deleted 1 resource(s) in 7ms"
}
]
}
curl --location --request POST 'http://localhost:8080/fhir/ValueSet/1/$expunge' \
--header 'Content-Type: application/json' \
--data-raw '
{
"resourceType": "Parameters",
"parameter": [
{
"name": "limit",
"valueInteger": 1000
},{
"name": "expungeDeletedResources",
"valueBoolean": true
},{
"name": "expungePreviousVersions",
"valueBoolean": true
}
]
}'
Response:
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>HAPI-1084: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint ["FK_TRMVALUESET_RES: PUBLIC.TRM_VALUESET FOREIGN KEY(RES_ID) REFERENCES PUBLIC.HFJ_RESOURCE(RES_ID) (CAST(1 AS BIGINT))"; SQL statement:\ndelete from hfj_resource where res_id=? [23503-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "HAPI-1084: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [\"FK_TRMVALUESET_RES: PUBLIC.TRM_VALUESET FOREIGN KEY(RES_ID) REFERENCES PUBLIC.HFJ_RESOURCE(RES_ID) (CAST(1 AS BIGINT))\"; SQL statement:\ndelete from hfj_resource where res_id=? [23503-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"
}
]
}
I'm having the same issue using 6.2.2. While trying to diagnose an issue with $expand
of ValueSet resources that we are creating, I following this thread:
https://groups.google.com/g/hapi-fhir/c/Zl6C6SHYzlM
Steps to reproduce:
$expunge
operation for this resource from my local server{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>HAPI-1084: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_trmvalueset_res]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "HAPI-1084: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_trmvalueset_res]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"
}
]
}
I've attempted to reproduce this but my test is passing - If anyone can see any difference between the test and your actual scenario (or if you can reproduce this on hapi.fhir.org) i'd love to see it.
Here's the test I added: https://github.com/hapifhir/hapi-fhir/pull/4509/files#diff-308f21ffaf90d666965a5134d1c0536987dbc890179f2e9a8c2e51e0cd1f4e08R263
Describe the bug
After deleting a record using the DELETE verb, we have attempted to $expunge the record, which resulted in a foreign key contraint exception.
Please see the stack trace attached.
To Reproduce Steps to reproduce the behavior: 1 Delete the resource
curl --location --request DELETE 'http://localhost:8080/fhir/ValueSet/102'
2 Expunge the resource
Expected behavior Resource should be expunged from the database.
Actual behaviour Forgeign Key Constraint Exception is raised
Screenshots
Environment (please complete the following information):