if (metaModel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType())) {
keyObj = metaModel.embeddable(entityMetadata.getIdAttribute().getBindableJavaType());
key = JAXBUtils.toObject(id, keyObj.getJavaType(), mediaType);
} else {
ObjectMapper mapper = new ObjectMapper();
key = mapper.convertValue(id, entityMetadata.getIdAttribute().getBindableJavaType());
}
entity = em.find(entityClass, key);
} catch (Exception e) {
log.error(e.getMessage());