Package org.hibernate.hql

Examples of org.hibernate.hql.QueryTranslator


  }

  protected void runClassicTranslator(String hql) throws Exception {
    SessionFactoryImplementor factory = getSessionFactoryImplementor();
    Map replacements = new HashMap();
    QueryTranslator oldQueryTranslator = null;
    try {
      QueryTranslatorFactory classic = new ClassicQueryTranslatorFactory();
      oldQueryTranslator = classic.createQueryTranslator( hql, hql, Collections.EMPTY_MAP, factory );
      oldQueryTranslator.compile( replacements, false );
    }
    catch ( Exception e ) {
      e.printStackTrace();
      throw e;
    }
    String oldsql = oldQueryTranslator.getSQLString();
    System.out.println( "HQL    : " + hql );
    System.out.println( "OLD SQL: " + oldsql );
  }
View Full Code Here


    if ( replacements == null ) {
      replacements = new HashMap();
    }

    // steve -> note that the empty maps here represent the currently enabled filters...
    QueryTranslator oldQueryTranslator = null;
    Exception oldException = null;
    try {
      System.out.println("Compiling with classic QueryTranslator...");
      QueryTranslatorFactory classic = new ClassicQueryTranslatorFactory();
      oldQueryTranslator = classic.createQueryTranslator( hql, hql, Collections.EMPTY_MAP, factory );
      oldQueryTranslator.compile( replacements, scalar );
    }
    catch ( QueryException e ) {
      oldException = e;
    }
    catch ( MappingException e ) {
      oldException = e;
    }

    QueryTranslator newQueryTranslator = null;
    Exception newException = null;
    try {
      System.out.println("Compiling with AST QueryTranslator...");
      newQueryTranslator = createNewQueryTranslator( hql, replacements, scalar );
    }
View Full Code Here

      assertTrue( "New query space does not contain " + o + "!", querySpaces.contains( o ) );
    }
  }

  protected Exception compileBadHql(String hql, boolean scalar) {
    QueryTranslator newQueryTranslator;
    Map replacements = null;
    Exception newException = null;
    SessionFactoryImplementor factory = getSessionFactoryImplementor();
    try {
      QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
      newQueryTranslator = ast.createQueryTranslator( hql, hql, Collections.EMPTY_MAP, factory );
      newQueryTranslator.compile( replacements, scalar );
    }
    catch ( QueryException e ) {
      newException = e;
    }
    catch ( MappingException e ) {
View Full Code Here

  private void compileWithAstQueryTranslator(String hql, boolean scalar) {
    Map replacements = new HashMap();
    QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
    SessionFactoryImplementor factory = getSessionFactoryImplementor();
    QueryTranslator newQueryTranslator = ast.createQueryTranslator( hql, hql, Collections.EMPTY_MAP, factory );
    newQueryTranslator.compile( replacements, scalar );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.hql.QueryTranslator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.