EntityManager em = getContext().getEntityManager();
if (StringUtils.isNotBlank(retrieve.namedQuery()))
return em.createNamedQuery(retrieve.namedQuery());
if (retrieve.nativeQuery()) {
if (retrieve.resultClass().equals(void.class))
return em.createNativeQuery(retrieve.query());
else
return em.createNativeQuery(retrieve.query(), retrieve.resultClass());
} else
return em.createQuery(retrieve.query());
}