Hey, i am working on Create an Event Listener that listens to patient creation by mherman22 · Pull Request #1065 · I-TECH-UW/OpenELIS-Global-2 · GitHub and i have had to do alot of changes especially with how beans are being created with an aim of making the existing tests pass and get the app up and running for me to test my changes.
I am getting an error in the terminal when i start the app, find the logs at Ubuntu Pastebin. I have written a test case and it passes but for some reason i am yet to establish, the enum value is sent as bytea and not as a string as it should.
I have even gone ahead to use type safe enabled by the jpa criteria api as seen below but all in vain:
public NotificationPayloadTemplate getSystemDefaultPayloadTemplateForType(NotificationPayloadType type) {
List<NotificationPayloadTemplate> data;
try {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<NotificationPayloadTemplate> criteriaQuery = criteriaBuilder.createQuery(NotificationPayloadTemplate.class);
Root<NotificationPayloadTemplate> root = criteriaQuery.from(NotificationPayloadTemplate.class);
criteriaQuery.where(criteriaBuilder.equal(root.get("type"), type));
criteriaQuery.orderBy(criteriaBuilder.asc(root.get("id")));
TypedQuery<NotificationPayloadTemplate> query = entityManager.createQuery(criteriaQuery);
query.setMaxResults(1);
data = query.getResultList();
} catch (RuntimeException e) {
LogEvent.logError(e);
throw new LIMSRuntimeException("Error in getSystemDefaultPayloadTemplateForType", e);
}
return data.isEmpty() ? null : data.get(0);
}