How to create a Custom Resource in hapi-fhir-jpaserver-starter

118 views
Skip to first unread message

Gunnar Hollander

unread,
Jul 19, 2021, 4:59:04 AM7/19/21
to HAPI FHIR
Hi All

I was trying to set up HAPI FHIR for DSTU3 with the hapi-fhir-jpaserver-starter project and tried to integrate a fully custom resource into it (I would have liked to avoid doing that, but due to legacy reasons there is no way around that custom resource).

So far I have created:
- CustomResource (extends DomainResource)
- BaseJpaResourceProviderCustomResourceDstu3 (extends JpaResourceProviderDstu3<CustomResource>)
- CustomResourceProvider (extends BaseJpaResourceProviderCustomResourceDstu3)
- IFhirResourceDaoCustomResource<T extends IBaseResource> extends IFhirResourceDao<T>

After that I added the CustomResource to the supported resourceTypes, registered the CustomType in the FhirContext and registered the CustomResourceProvider in the BaseJpaRestfulServer initialize() method

The CustomResource shows up on the Web Tester UI but if I try to create a new entry via CRUD Operations tab I get the following message:

Failed to parse message body. Error was: DataFormatException at [[row,col {unknown-source}]: [1,1]]: Unknown resource name "CustomResource" (this name is not known in FHIR version "DSTU3")

Any idea on how I get it to recognize my custom resource? Any help or pointer is appreciated.

Regards

Daya Sharma

unread,
Oct 19, 2021, 7:07:54 PM10/19/21
to HAPI FHIR
Hi Gunnar,

Were you able to solve this DataFormatException problem? If yes, do you mind sharing the solution and/or root cause analysis?

Thanks

Reply all
Reply to author
Forward
0 new messages