LoanApplication application = (LoanApplication) objectMessage.getObject();
int score = creditRatingLogic.rateApplication(application);
Rating rating = new Rating();
rating.setScore(score);
entityManager.persist(rating);
entityManager.flush();
Execution execution = runtimeService.createExecutionQuery()
.processInstanceId(message.getStringProperty("correlationId"))
.activityId("receiveRating")
.singleResult();
businessProcess.associateExecutionById(execution.getId());
businessProcess.setVariable("ratingId", rating.getId());
businessProcess.signalExecution();
} catch (JMSException e) {
throw new EJBException("Could not unwrap object message" + e.getMessage(), e);
}