Hello,
I am in the process of migrating openmrs-core to hibernate 6.x. One issue I have ran into is related to Person.isPatient
. In the person.hbm.xml we have a patient
property that is created from a formula
<property name="patient" type="boolean" insert="false" update="false" lazy="true">
<formula>case when exists (select * from patient p where p.patient_id = person_id) then 1 else 0 end</formula>
</property>
Then we have this indexed field derived from the patient
bool
@GenericField
@NotAudited
@IndexingDependency(derivedFrom = @ObjectPath(@PropertyValue(propertyName = "patient")))
private boolean isPatient;
This seemed fine in hibernate 5, but in 6.x I get the below error:
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH000520: Hibernate Search encountered failures during bootstrap. Failures:
Hibernate ORM mapping:
type 'org.openmrs.PatientIdentifier':
path '.patient<no value extractors>.isPatient<no value extractors>':
failures:
- value involves formulas
type 'org.openmrs.PersonAttribute':
path '.person<no value extractors>.isPatient<no value extractors>':
failures:
- value involves formulas
type 'org.openmrs.PersonName':
path '.person<no value extractors>.isPatient<no value extractors>':
failures:
- value involves formulas
Here is the full stack trace - https://pastebin.com/qSUHJY4K
Having trouble finding a solution for this so just posting it here if anyone has experience with formulas or any ideas?