FHIR Chat · Error creating ValueSet resource · hapi

Stream: hapi

Topic: Error creating ValueSet resource


view this post on Zulip Sean McIlvenna (Jul 02 2018 at 17:45):

I have a local installation of the HAPI server. When I attempt to create a ValueSet resource, I am getting the following error:

view this post on Zulip Sean McIlvenna (Jul 02 2018 at 17:45):

Failed to call access method: org.springframework.dao.DataIntegrityViolationException: could not execute batch; SQL [insert into HFJ_RESOURCE (RES_DELETED_AT, RES_VERSION, FORCED_ID_PID, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, SP_HAS_LINKS, HASH_SHA256, SP_INDEX_STATUS, RES_LANGUAGE, SP_CMPSTR_UNIQ_PRESENT, SP_COORDS_PRESENT, SP_DATE_PRESENT, SP_NUMBER_PRESENT, SP_QUANTITY_PRESENT, SP_STRING_PRESENT, SP_TOKEN_PRESENT, SP_URI_PRESENT, RES_PROFILE, RES_TYPE, RES_VER, RES_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [res_encoding]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch

view this post on Zulip Sean McIlvenna (Jul 02 2018 at 17:45):

Has anyone experienced this? Any idea what this is from?

view this post on Zulip Joel Schneider (Jul 04 2018 at 00:33):

I've seen similar errors before when usng HAPI with PostgreSQL, but haven't gone to the effort of tracking down a root cause. There have been recent modifications to HAPI's database layer, and it's possible your system is encountering a problem when attempting to persist data to a database created by an earlier version of HAPI. My workaround was to drop & recreate the PosgreSQL database, and let HAPI repopulate it.

view this post on Zulip Rob Hausam (Jul 04 2018 at 00:50):

The 'res_encoding' column was dropped in release 3.3.0:

This release corrects an inefficiency in the JPA Server, but requires a schema change in order to update. Prior to this version of HAPI FHIR, a CLOB column containing the complete resource body was stored in two tables: HFJ_RESOURCE and HFJ_RES_VER. Because the same content was stored in two places, the database consumed more space than is needed to.

In order to reduce this duplication, the RES_TEXT and RES_ENCODING columns have been dropped from the HFJ_RESOURCE table, and the RES_TEXT and RES_ENCODING columns have been made NULLABLE on the HFJ_RES_VER table.

The following migration script may be used to apply these changes to your database. Naturally you should back your database up prior to making this change.
ALTER TABLE hfj_resource DROP COLUMN res_text;
ALTER TABLE hfj_resource DROP COLUMN res_encoding;
ALTER TABLE hfj_res_ver ALTER COLUMN res_encoding DROP NOT NULL;
ALTER TABLE hfj_res_ver ALTER COLUMN res_text DROP NOT NULL;


Last updated: Apr 12 2022 at 19:14 UTC