start = System.currentTimeMillis();
try {
// invoke underlying entity manager method and if not running in a tx
// return a Query wrapper around the result.
EntityManager entityManager = getEntityManager();
return detachTypedQueryNonTxInvocation(entityManager,entityManager.createNamedQuery(name, resultClass));
} finally {
if (isTraceEnabled) {
long elapsed = System.currentTimeMillis() - start;
ROOT_LOGGER.tracef("createNamedQuery name '%s', resultClass '%s' took %dms", name, resultClass.getName(), elapsed);
}