Package org.hibernate.sql

Examples of org.hibernate.sql.InFragment


      "";
  }

  private String discriminatorFilterFragment(String alias) throws MappingException {
    if ( needsDiscriminator() ) {
      InFragment frag = new InFragment();

      if ( isDiscriminatorFormula() ) {
        frag.setFormula( alias, getDiscriminatorFormulaTemplate() );
      }
      else {
        frag.setColumn( alias, getDiscriminatorColumnName() );
      }

      String[] subclasses = getSubclassClosure();
      for ( int i=0; i<subclasses.length; i++ ) {
        final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclasses[i] );
        if ( !queryable.isAbstract() ) frag.addValue( queryable.getDiscriminatorSQLValue() );
      }

      StringBuffer buf = new StringBuffer(50)
        .append(" and ")
        .append( frag.toFragmentString() );

      return buf.toString();
    }
    else {
      return "";
View Full Code Here


      "";
  }

  private String discriminatorFilterFragment(String alias) throws MappingException {
    if ( needsDiscriminator() ) {
      InFragment frag = new InFragment();

      if ( isDiscriminatorFormula() ) {
        frag.setFormula( alias, getDiscriminatorFormulaTemplate() );
      }
      else {
        frag.setColumn( alias, getDiscriminatorColumnName() );
      }

      String[] subclasses = getSubclassClosure();
      for ( int i=0; i<subclasses.length; i++ ) {
        final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclasses[i] );
        if ( !queryable.isAbstract() ) frag.addValue( queryable.getDiscriminatorSQLValue() );
      }

      StringBuffer buf = new StringBuffer(50)
        .append(" and ")
        .append( frag.toFragmentString() );

      return buf.toString();
    }
    else {
      return "";
View Full Code Here

    if ( keyColumnNames.length==1 ) {
      // NOT A COMPOSITE KEY
      //     for batching, use "foo in (?, ?, ?)" for batching
      //    for no batching, use "foo = ?"
      // (that distinction is handled inside InFragment)
      final InFragment in = new InFragment().setColumn( alias, keyColumnNames[0] );
      for ( int i = 0; i < batchSize; i++ ) {
        in.addValue( "?" );
      }
      select.appendRestrictions( in.toFragmentString() );
    }
    else {
      // A COMPOSITE KEY...
      final ConditionFragment keyRestrictionBuilder = new ConditionFragment()
          .setTableAlias( alias )
View Full Code Here

   */
  protected StringBuilder whereString(String alias, String[] columnNames, int batchSize) {
    if ( columnNames.length==1 ) {
      // if not a composite key, use "foo in (?, ?, ?)" for batching
      // if no batch, and not a composite key, use "foo = ?"
      InFragment in = new InFragment().setColumn( alias, columnNames[0] );
      for ( int i=0; i<batchSize; i++ ) in.addValue("?");
      return new StringBuilder( in.toFragmentString() );
    }
    else {
      //a composite key
      ConditionFragment byId = new ConditionFragment()
          .setTableAlias(alias)
View Full Code Here

    if ( !needsDiscriminator() && !hasTreatAs) {
      return "";
    }

    final InFragment frag = new InFragment();
    if ( isDiscriminatorFormula() ) {
      frag.setFormula( alias, getDiscriminatorFormulaTemplate() );
    }
    else {
      frag.setColumn( alias, getDiscriminatorColumnName() );
    }

    if ( hasTreatAs ) {
      frag.addValues( decodeTreatAsRequests( treatAsDeclarations ) );
    }
    else {
      frag.addValues( fullDiscriminatorValues() );
    }

    return " and " + frag.toFragmentString();
  }
View Full Code Here

   */
  protected StringBuffer whereString(String alias, String[] columnNames, int batchSize) {
    if ( columnNames.length==1 ) {
      // if not a composite key, use "foo in (?, ?, ?)" for batching
      // if no batch, and not a composite key, use "foo = ?"
      InFragment in = new InFragment().setColumn( alias, columnNames[0] );
      for ( int i=0; i<batchSize; i++ ) in.addValue("?");
      return new StringBuffer( in.toFragmentString() );
    }
    else {
      //a composite key
      ConditionFragment byId = new ConditionFragment()
          .setTableAlias(alias)
View Full Code Here

      "";
  }

  private String discriminatorFilterFragment(String alias) throws MappingException {
    if ( needsDiscriminator() ) {
      InFragment frag = new InFragment();

      if ( isDiscriminatorFormula() ) {
        frag.setFormula( alias, getDiscriminatorFormulaTemplate() );
      }
      else {
        frag.setColumn( alias, getDiscriminatorColumnName() );
      }

      String[] subclasses = getSubclassClosure();
      for ( int i=0; i<subclasses.length; i++ ) {
        final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclasses[i] );
        if ( !queryable.isAbstract() ) frag.addValue( queryable.getDiscriminatorSQLValue() );
      }

      StringBuffer buf = new StringBuffer(50)
        .append(" and ")
        .append( frag.toFragmentString() );

      return buf.toString();
    }
    else {
      return "";
View Full Code Here

      "";
  }

  private String discriminatorFilterFragment(String alias) throws MappingException {
    if ( needsDiscriminator() ) {
      InFragment frag = new InFragment();

      if ( isDiscriminatorFormula() ) {
        frag.setFormula( alias, getDiscriminatorFormulaTemplate() );
      }
      else {
        frag.setColumn( alias, getDiscriminatorColumnName() );
      }

      String[] subclasses = getSubclassClosure();
      for ( int i=0; i<subclasses.length; i++ ) {
        final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclasses[i] );
        if ( !queryable.isAbstract() ) frag.addValue( queryable.getDiscriminatorSQLValue() );
      }

      StringBuffer buf = new StringBuffer(50)
        .append(" and ")
        .append( frag.toFragmentString() );

      return buf.toString();
    }
    else {
      return "";
View Full Code Here

   */
  protected StringBuffer whereString(String alias, String[] columnNames, int batchSize) {
    if ( columnNames.length==1 ) {
      // if not a composite key, use "foo in (?, ?, ?)" for batching
      // if no batch, and not a composite key, use "foo = ?"
      InFragment in = new InFragment().setColumn( alias, columnNames[0] );
      for ( int i=0; i<batchSize; i++ ) in.addValue("?");
      return new StringBuffer( in.toFragmentString() );
    }
    else {
      //a composite key
      ConditionFragment byId = new ConditionFragment()
          .setTableAlias(alias)
View Full Code Here

      "";
  }

  private String discriminatorFilterFragment(String alias) throws MappingException {
    if ( needsDiscriminator() ) {
      InFragment frag = new InFragment();

      if ( isDiscriminatorFormula() ) {
        frag.setFormula( alias, getDiscriminatorFormulaTemplate() );
      }
      else {
        frag.setColumn( alias, getDiscriminatorColumnName() );
      }

      String[] subclasses = getSubclassClosure();
      for ( int i=0; i<subclasses.length; i++ ) {
        final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclasses[i] );
        if ( !queryable.isAbstract() ) frag.addValue( queryable.getDiscriminatorSQLValue() );
      }

      StringBuffer buf = new StringBuffer(50)
        .append(" and ")
        .append( frag.toFragmentString() );

      return buf.toString();
    }
    else {
      return "";
View Full Code Here

TOP

Related Classes of org.hibernate.sql.InFragment

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.