Package org.hibernate.hql.ast

Examples of org.hibernate.hql.ast.SqlGenerator$SqlWriter


    String userWhereClause = "";
    if ( whereClause.getNumberOfChildren() != 0 ) {
      // If a where clause was specified in the update/delete query, use it to limit the
      // returned ids here...
      try {
        SqlGenerator sqlGenerator = new SqlGenerator( getFactory() );
        sqlGenerator.whereClause( whereClause );
        userWhereClause = sqlGenerator.getSQL().substring( 7 )// strip the " where "
      }
      catch ( RecognitionException e ) {
        throw new HibernateException( "Unable to generate id select for DML operation", e );
      }
      if ( whereJoinFragment.length() > 0 ) {
View Full Code Here


  public BasicExecutor(HqlSqlWalker walker, Queryable persister) {
    super( walker, log );
    this.persister = persister;
    try {
      SqlGenerator gen = new SqlGenerator( getFactory() );
      gen.statement( walker.getAST() );
      sql = gen.getSQL();
      gen.getParseErrorHandler().throwQueryException();
    }
    catch ( RecognitionException e ) {
      throw QuerySyntaxException.convert( e );
    }
  }
View Full Code Here

    JoinSequence joinSequence = fromElement.getJoinSequence();
    String[] indexCols = queryableCollection.getIndexColumnNames();
    if ( indexCols.length != 1 ) {
      throw new QueryException( "composite-index appears in []: " + collectionNode.getPath() );
    }
    SqlGenerator gen = new SqlGenerator( getSessionFactoryHelper().getFactory() );
    try {
      gen.simpleExpr( index ); //TODO: used to be exprNoParens! was this needed?
    }
    catch ( RecognitionException e ) {
      throw new QueryException( e.getMessage(), e );
    }
    String expression = gen.getSQL();
    joinSequence.addCondition( collectionTableAlias + '.' + indexCols[0] + " = " + expression );

    // Now, set the text for this node.  It should be the element columns.
    String[] elementColumns = queryableCollection.getElementColumnNames( elementTable );
    setText( elementColumns[0] );
View Full Code Here

    String userWhereClause = "";
    if ( whereClause.getNumberOfChildren() != 0 ) {
      // If a where clause was specified in the update/delete query, use it to limit the
      // returned ids here...
      try {
        SqlGenerator sqlGenerator = new SqlGenerator( getFactory() );
        sqlGenerator.whereClause( whereClause );
        userWhereClause = sqlGenerator.getSQL().substring( 7 )// strip the " where "
        idSelectParameterSpecifications = sqlGenerator.getCollectedParameters();
      }
      catch ( RecognitionException e ) {
        throw new HibernateException( "Unable to generate id select for DML operation", e );
      }
      if ( whereJoinFragment.length() > 0 ) {
View Full Code Here

    String userWhereClause = "";
    if ( whereClause.getNumberOfChildren() != 0 ) {
      // If a where clause was specified in the update/delete query, use it to limit the
      // returned ids here...
      try {
        SqlGenerator sqlGenerator = new SqlGenerator( getFactory() );
        sqlGenerator.whereClause( whereClause );
        userWhereClause = sqlGenerator.getSQL().substring( 7 )// strip the " where "
        idSelectParameterSpecifications = sqlGenerator.getCollectedParameters();
      }
      catch ( RecognitionException e ) {
        throw new HibernateException( "Unable to generate id select for DML operation", e );
      }
      if ( whereJoinFragment.length() > 0 ) {
View Full Code Here

    JoinSequence joinSequence = fromElement.getJoinSequence();
    String[] indexCols = queryableCollection.getIndexColumnNames();
    if ( indexCols.length != 1 ) {
      throw new QueryException( "composite-index appears in []: " + collectionNode.getPath() );
    }
    SqlGenerator gen = new SqlGenerator( getSessionFactoryHelper().getFactory() );
    try {
      gen.simpleExpr( selector ); //TODO: used to be exprNoParens! was this needed?
    }
    catch ( RecognitionException e ) {
      throw new QueryException( e.getMessage(), e );
    }
    String selectorExpression = gen.getSQL();
    joinSequence.addCondition( collectionTableAlias + '.' + indexCols[0] + " = " + selectorExpression );
    List paramSpecs = gen.getCollectedParameters();
    if ( paramSpecs != null ) {
      switch ( paramSpecs.size() ) {
        case 0 :
          // nothing to do
          break;
View Full Code Here

  }

  public String getSqlAssignmentFragment() {
    if ( sqlAssignmentString == null ) {
      try {
        SqlGenerator sqlGenerator = new SqlGenerator( factory );
        sqlGenerator.comparisonExpr( eq, false )// false indicates to not generate parens around the assignment
        sqlAssignmentString = sqlGenerator.getSQL();
      }
      catch( Throwable t ) {
        throw new QueryException( "cannot interpret set-clause assignment" );
      }
    }
View Full Code Here

    String userWhereClause = "";
    if ( whereClause.getNumberOfChildren() != 0 ) {
      // If a where clause was specified in the update/delete query, use it to limit the
      // returned ids here...
      try {
        SqlGenerator sqlGenerator = new SqlGenerator( getFactory() );
        sqlGenerator.whereClause( whereClause );
        userWhereClause = sqlGenerator.getSQL().substring( 7 )// strip the " where "
        idSelectParameterSpecifications = sqlGenerator.getCollectedParameters();
      }
      catch ( RecognitionException e ) {
        throw new HibernateException( "Unable to generate id select for DML operation", e );
      }
      if ( whereJoinFragment.length() > 0 ) {
View Full Code Here

  public BasicExecutor(HqlSqlWalker walker, Queryable persister) {
    super( walker, log );
    this.persister = persister;
    try {
      SqlGenerator gen = new SqlGenerator( getFactory() );
      gen.statement( walker.getAST() );
      sql = gen.getSQL();
      gen.getParseErrorHandler().throwQueryException();
      parameterSpecifications = gen.getCollectedParameters();
    }
    catch ( RecognitionException e ) {
      throw QuerySyntaxException.convert( e );
    }
  }
View Full Code Here

    String userWhereClause = "";
    if ( whereClause.getNumberOfChildren() != 0 ) {
      // If a where clause was specified in the update/delete query, use it to limit the
      // returned ids here...
      try {
        SqlGenerator sqlGenerator = new SqlGenerator( getFactory() );
        sqlGenerator.whereClause( whereClause );
        userWhereClause = sqlGenerator.getSQL().substring( 7 )// strip the " where "
      }
      catch ( RecognitionException e ) {
        throw new HibernateException( "Unable to generate id select for DML operation", e );
      }
      if ( whereJoinFragment.length() > 0 ) {
View Full Code Here

TOP

Related Classes of org.hibernate.hql.ast.SqlGenerator$SqlWriter

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.