Package org.hibernate

Examples of org.hibernate.Query.iterate()


        qry.setString(0, key.toCanonicalString());
       
        // We really should consider the possibility of multiple messages matching a criteria.
        // When the message is handled, its not too convenient to attempt to determine if the
        // received message conflicts with one already received.
        Iterator mcors = qry.iterate();
        try {
            if (!mcors.hasNext()) {
                __log.debug(hdr + "did not find a MESSAGE entry.");
                return null;
            }
View Full Code Here


            try {
                selector = (HCorrelatorSelector) q.uniqueResult();
            } catch (Exception ex) {
                __log.debug("Strange, could not get a unique result for findRoute, trying to iterate instead.");

                Iterator i = q.iterate();
                if (i.hasNext()) selector = (HCorrelatorSelector) i.next();
                else selector = null;
                Hibernate.close(i);
            }
   
View Full Code Here

    private HVariableProperty _getProperty(String propertyName){
        Iterator iter;
        Query qry = getSession().createQuery(QUERY_PROPERTY);
        qry.setLong(0, _data.getId());
        qry.setString(1, propertyName);
        iter = qry.iterate();
        return iter.hasNext()
                ? (HVariableProperty)iter.next()
                : null;
    }
View Full Code Here

    Iterator iter;
    Query qry = getSession().createQuery(QRY_VARIABLES);
    qry.setString(0, variableName);
    qry.setInteger(1, scopeModelId);
    qry.setLong(2, _instance.getId());
    iter = qry.iterate();

    while(iter.hasNext()) {
      results.add(new XmlDataDaoImpl(_sm, (HXmlData)iter.next()));
    }
    Hibernate.close(iter);
View Full Code Here

  public Collection<ActivityRecoveryDAO> getActivityRecoveries() {
    List<ActivityRecoveryDAO> results = new ArrayList<ActivityRecoveryDAO>();
    Query qry = getSession().createQuery(QRY_RECOVERIES);
    qry.setLong(0, _instance.getId());
    Iterator iter = qry.iterate();
    while (iter.hasNext())
      results.add(new ActivityRecoveryDaoImpl(_sm, (HActivityRecovery) iter.next()));
    Hibernate.close(iter);
    return results;
  }
View Full Code Here

    t = s.beginTransaction();
    s.setDefaultReadOnly( false );
    int i = 0;
    Query query = s.createQuery("from DataPoint dp order by dp.x asc");
    s.setDefaultReadOnly( true );
    Iterator it = query.iterate();
    s.setDefaultReadOnly( false );
    while ( it.hasNext() ) {
      DataPoint dp = (DataPoint) it.next();
      if (++i==50) {
        s.setReadOnly(dp, false);
View Full Code Here

    assertFalse( query.isReadOnly() );
    query.setReadOnly( true );
    assertTrue( query.isReadOnly() );
    s.setDefaultReadOnly( false );
    assertFalse( s.isDefaultReadOnly() );
    Iterator it = query.iterate();
    assertTrue( query.isReadOnly() );
    DataPoint dpLast = ( DataPoint ) s.get( DataPoint.class, dp.getId() );
    assertFalse( s.isReadOnly( dpLast ) );
    query.setReadOnly( false );
    assertFalse( query.isReadOnly() );
View Full Code Here

    assertTrue( query.isReadOnly() );
    query.setReadOnly( false );
    assertFalse( query.isReadOnly() );
    s.setDefaultReadOnly( true );
    assertTrue( s.isDefaultReadOnly() );
    Iterator it = query.iterate();
    assertFalse( query.isReadOnly() );
    DataPoint dpLast = ( DataPoint ) s.get( DataPoint.class, dp.getId() );
    assertTrue( s.isReadOnly( dpLast ) );
    query.setReadOnly( true );
    assertTrue( query.isReadOnly() );
View Full Code Here

    list = new ArrayList();
    list.add(did);
    list.add( new Long(-1) );
    q.setParameterList("ids", list);
    assertTrue( q.list().size()==1 );
    assertTrue( q.iterate().hasNext() );
    assertTrue( s.createFilter( master.getDetails(), "where this.id > -1" ).list().size()==2 );
    assertTrue( s.createFilter( master.getDetails(), "select this.master where this.id > -1" ).list().size()==2 );
    assertTrue(
        s.createFilter( master.getDetails(), "select m from Master m where this.id > -1 and this.master=m" )
            .list()
View Full Code Here

    assertTrue( s.createFilter( master.getIncoming(), "" ).list().size()==0 );

    Query f = s.createFilter( master.getDetails(), "select max(this.i) where this.i < :top and this.i>=:bottom" );
    f.setInteger("top", 100);
    f.setInteger("bottom", 0);
    assertEquals( f.iterate().next(), new Integer(12) );
    f.setInteger("top", 2);
    assertEquals( f.iterate().next(), new Integer(0) );

    f = s.createFilter( master.getDetails(), "select max(this.i) where this.i not in (:list)" );
    Collection coll = new ArrayList();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.