String sql = _persistenceUnit.getNamedQuery(name);
if (sql != null)
return createQuery(sql);
NamedNativeQueryConfig nativeQuery
= _persistenceUnit.getNamedNativeQuery(name);
sql = nativeQuery.getQuery();
String resultSetMapping = nativeQuery.getResultSetMapping();
if (! ((resultSetMapping == null) || "".equals(resultSetMapping)))
return createNativeQuery(sql, resultSetMapping);
Class resultClass = nativeQuery.getResultClass();
AmberEntityHome entityHome
= _persistenceUnit.getEntityHome(resultClass.getName());
EntityType entityType = entityHome.getEntityType();