private String rewriteHibernate(Query query) {
org.hibernate.ejb.HibernateEntityManager em = (org.hibernate.ejb.HibernateEntityManager)this.entityManager;
org.hibernate.ejb.HibernateQuery qi = (org.hibernate.ejb.HibernateQuery)(query);
em.getSession();
HQL2SQLStatementRewriter queryRewriter = new HQL2SQLStatementRewriter(em.getSession());
String sqlQueryString = queryRewriter.rewrite( qi.getHibernateQuery().getQueryString());
return sqlQueryString;
}
}