public TypedQueryFactoryGenerator(EntityManager em, NamedQuery namedQuery) {
this.jpaQuery = Assert.notNull(namedQuery.query());
try {
HqlParser parser = HqlParser.getInstance(jpaQuery);
parser.statement();
AST hqlAst = parser.getAST();
if (logger.isDebugEnabled()) {
logger.debug("First-level parse tree for " + namedQuery.name() + ":");
parser.showAst(hqlAst, System.out);
}
SessionImplementor hibernateSession = em.unwrap(SessionImplementor.class);
ASTQueryTranslatorFactory translatorFactory = new ASTQueryTranslatorFactory();
query = (QueryTranslatorImpl) translatorFactory.createQueryTranslator(