Package org.hibernate

Examples of org.hibernate.Query.uniqueResult()


            q.setString(0, key == null ? null : key.toCanonicalString());
            q.setLockMode("this", LockMode.UPGRADE);

            HCorrelatorSelector selector;
            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())
View Full Code Here


  public ScopeDAO getRootScope() {
    if (_root != null)
      return _root;
    Query rootQry = getSession().createFilter(_instance.getScopes(),
        "where this.parentScope is null");
    HScope hroot = (HScope)rootQry.uniqueResult();
    if (hroot == null)
      return null;
    return _root = new ScopeDaoImpl(_sm, hroot);
  }
  /**
 
View Full Code Here

     */
    public PartnerLinkDAO getPartnerLink(int plinkId) {
        Query qry = getSession().createQuery(QRY_SCOPE_EPR);
        qry.setInteger(0,plinkId);
        qry.setEntity(1,_scope);
        HPartnerLink hpl = (HPartnerLink) qry.uniqueResult();
        if (hpl == null)
            return null;
        return new PartnerLinkDAOImpl(_sm, hpl);
    }

View Full Code Here

    public PartnerLinkDAO getPartnerLink(int plinkId) {
        Query qry = getSession().createQuery(QRY_SCOPE_EPR);
        qry.setInteger(0,plinkId);
        qry.setEntity(1,_scope);
        HPartnerLink hpl = (HPartnerLink) qry.uniqueResult();
        if (hpl == null)
            return null;
        return new PartnerLinkDAOImpl(_sm, hpl);
    }
View Full Code Here

            q.setString(2, _hobj.getCorrelatorId());
            q.setLockMode("hs", LockMode.UPGRADE);

            HCorrelatorSelector selector;
            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();
View Full Code Here

  public ScopeDAO getRootScope() {
    if (_root != null)
      return _root;
    Query rootQry = getSession().createFilter(_instance.getScopes(),
        "where this.parentScope is null");
    HScope hroot = (HScope)rootQry.uniqueResult();
    if (hroot == null)
      return null;
    return _root = new ScopeDaoImpl(_sm, hroot);
  }
  /**
 
View Full Code Here

                        "where deploymentProperty.key = '" + DeploymentImpl.KEY_PROCESS_DEFINITION_ID + "' " +
                        "  and deploymentProperty.stringValue = '" + processDefinitionId + "' "
        );
        query.setCacheable(true);
        query.setMaxResults(1);
        DeploymentProperty deploymentProperty = (DeploymentProperty) query.uniqueResult();
        return deploymentProperty;
    }
}
View Full Code Here

    public void testSellCar() throws Exception {
        prepareData();
        Session session = openSession();
        Transaction tx = session.beginTransaction();
        Query query = session.createQuery( "from Seller" );
        Seller seller = (Seller) query.uniqueResult();
        assertNotNull( seller );
        assertEquals( 1, seller.getBuyers().size() );
        tx.commit();
        session.close();
    }
View Full Code Here

    s = openSession();
    tx = s.beginTransaction();
    Query q = s.createQuery( "select c from Client c where c.name = :name" );
    q.setString( "name", c.getName() );
    c = ( Client ) q.uniqueResult();
    //c = (Client) s.get(Client.class, c.getId());
    assertNotNull( c );
    tx.commit();
    s.close();
    assertNotNull( c.getAddress() );
View Full Code Here

    s.close();

    s = openSession();
    tx = s.beginTransaction();
    Query q = s.createQuery( "from " + Life.class.getName() );
    life = (Life) q.uniqueResult();
    assertEquals( "Long long description", life.fullDescription );
    tx.commit();
    s.close();
  }
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.