hsql to sql java
===

Is it possible to translate in run time, the HSQL statement to SQL using EntityManager? 

I've found this solution but I don't have the sessionFactory, I have EntityManager

    protected String toSql(String hqlQueryText) {
    	if (sessionFactory != null && hqlQueryText != null && hqlQueryText.trim().length() > 0) {
    	    final QueryTranslatorFactory translatorFactory = new ASTQueryTranslatorFactory();
    	    final SessionFactoryImplementor factory = (SessionFactoryImplementor) sessionFactory;
    	    final QueryTranslator translator = translatorFactory.createQueryTranslator(hqlQueryText, hqlQueryText,
		    Collections.EMPTY_MAP, factory);
    	    translator.compile(Collections.EMPTY_MAP, false);
    	    return translator.getSQLString();
        	}
    	return null;
    }