regarding hapi fhir server starter

568 views
Skip to first unread message

kenc...@gmail.com

unread,
Mar 16, 2019, 11:57:51 PM3/16/19
to HAPI FHIR

Dear friends,

I downloaded the hapi fhir jpa-server starter project from the hapi fhir site.
Although I got everything compiled, installed it on tomcat and got the application
running I have a problem with the database during runtime.

I switchec to mysql in hapi properties file 

datasource.driver=com.mysql.cj.jdbc.Driver
datasource.url=jdbc:mysql://localhost:3306/hapi_dstu3

But while deploying the application I get problems with the DDL scripts running
on the database.


Caused by: java.sql.SQLSyntaxErrorException: Specified key was too long; max key length is 1000 bytes


2019-03-17 09:26:11.120 [localhost-startStop-1] WARN  o.h.t.s.i.ExceptionHandlerLoggedImpl [ExceptionHandlerLoggedImpl.java:27] GenerationTarget encountered exception accepting command : Error executing DDL "create index IDX_CNCPT_MP_GRP_ELM_TGT_CD on TRM_CONCEPT_MAP_GRP_ELM_TGT (TARGET_CODE)" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create index IDX_CNCPT_MP_GRP_ELM_TGT_CD on TRM_CONCEPT_MAP_GRP_ELM_TGT (TARGET_CODE)" via JDBC Sta


I understand that the index key is too large and script might need to be modified to reduce the size of the index.
Main question is where are the scripts located in the project.

Thanks
Ken

James Agnew

unread,
Mar 17, 2019, 11:04:46 AM3/17/19
to kenc...@gmail.com, HAPI FHIR
Did you also modify the dialect setting to specify MySQL?

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/1b3ab34a-301f-4308-b967-e57e39c336b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kenc...@gmail.com

unread,
Mar 19, 2019, 6:21:26 AM3/19/19
to HAPI FHIR
Dear James,

Yes I had modified the dialect setting as well

hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

The main issue for me is that I am not able to locate the DDL scripts
that are running for the STU3.

Kindly guide me so that I could check the script for the issue.

Regards
Ken

James Agnew

unread,
Mar 19, 2019, 6:48:29 AM3/19/19
to Kenneth Carvalho, HAPI FHIR
This looks to be the same issue discussed here:

Basically, we have a VARCHAR column in the ConceptMap tables that is 500 chars long and there is an index declared on it. That seems to violate the maximum index length of 1000 bytes on some versions/platforms of MySQL (although I'm not sure which, I haven't seen this issue before).

There are a few suggestions on that page around how to solve this.

The DDL for HAPI FHIR JPA is available here, but I think you'll need to adjust that index length for it to work. I guess you could also reduce this column length as an alternative: https://smilecdr.com/docs/current/database_administration/setting_up_mysql_or_mariadb.html#setting-up-a-fhir-storage-relational-database

Cheers,
James

kenc...@gmail.com

unread,
Mar 20, 2019, 2:05:38 AM3/20/19
to HAPI FHIR
Hello James,

That resolves all my index related questions and also thanks
for the DDL link.
But my actual question is where is the DDL script located within the
hapi-fhir-jpa-server-starter project.
So then I can make changes to the script being used 
within this project.

Thanks,
Ken

James Agnew

unread,
Mar 20, 2019, 4:01:18 AM3/20/19
to Kenneth Carvalho, HAPI FHIR
The DDL is generated dynamically by Hibernate, you can't really edit it in a live system.

Hibernate won't touch columns that already exist though, even if they aren't the same length so you can pre-create this (or any) table with different values if you want.

Cheers,
James

kenc...@gmail.com

unread,
Mar 21, 2019, 7:44:59 AM3/21/19
to HAPI FHIR
But I don't see any .sql file containing queries or any xml files
containing any configurations for Hibernate to generate
the tables dynamically. Not sure what I am missing.

k...@simpatico.ai

unread,
Mar 21, 2019, 9:28:36 AM3/21/19
to HAPI FHIR
Hi Ken,

After building hapi-fhir, you can find sql scripts to create the database in hapi-fhir-jpaserver-base/target/classes/ca/uhn/hapi/fhir/jpa/docs/database.

Sincerely,
Ken

James Agnew

unread,
Mar 21, 2019, 10:48:16 AM3/21/19
to Kenneth Carvalho, HAPI FHIR
Hibernate auto generates the DDL based on metadata in the classes. I'm sorry but again, there is no way to modify it in the starter project.

You can pre-create tables if you want them to have different column lengths, and hibernate will not override your preferences.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.

kenc...@gmail.com

unread,
Mar 23, 2019, 8:00:56 AM3/23/19
to HAPI FHIR
Thanks...just the information I was looking for.

Regards,
Ken


On Sunday, March 17, 2019 at 9:27:51 AM UTC+5:30, kenc...@gmail.com wrote:

kenc...@gmail.com

unread,
Mar 25, 2019, 6:39:29 AM3/25/19
to HAPI FHIR
Sorry I am again looking into this problem.
This time in the context of  hapi-fhir-jpa-starter


Error executing DDL "create index IDX_SP_URI on HFJ_SPIDX_URI (RES_TYPE, SP_NAME, SP_URI)" via JDBC Statement


java.sql.SQLSyntaxErrorException: Specified key was too long; max key length is 1000 bytes
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create index IDX_SP_URI_HASH_IDENTITY on HFJ_SPIDX_URI (HASH_IDENTITY, 
SP_URI)" 


and there is a list of such errors for each index being attempted for creation.

You had shared the SMILE link for database...are you referring to the scripts under cluster manager db
like this table here.

And should I execute these scripts after the index correction in a database with name
hapi_dstu3 and then deploy the app?

create table CDR_AUDIT_EVT ( PID bigint not null, AUSER_TYPE integer, REMOTE_ADDRESS varchar(255), HAVE_TARGET_MODULES bit not null, HAVE_TARGET_RESOURCES bit not null, HAVE_TARGET_USERS bit not null, EVT_TIMESTAMP datetime(6) not null, TYPE_DISPLAY varchar(200) not null, CLIENT_PID bigint, ENDPOINT_MODULE_PID bigint not null, TYPE_PID bigint not null, USER_PID bigint, primary key (PID) ) engine=InnoDB;






On Sunday, March 17, 2019 at 9:27:51 AM UTC+5:30, kenc...@gmail.com wrote:

kenc...@gmail.com

unread,
Mar 26, 2019, 6:13:11 AM3/26/19
to HAPI FHIR
I was trying to understand from how JpaRestfulServer is achieving the task of obtaining the instance
of a Spring bean with the statement....

appCtx.getBean("mySystemProviderDstu3"


On Sunday, March 17, 2019 at 9:27:51 AM UTC+5:30, kenc...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages