Package org.hibernate

Examples of org.hibernate.Criteria.createCriteria()


        CriteriaBuilder cb = new CriteriaBuilder();
        Criteria crit = getSession().createCriteria(HBpelEvent.class);
        if (ifilter != null)
            cb.buildCriteria(crit, efilter);
        if (ifilter != null)
            cb.buildCriteria(crit.createCriteria("instance"), ifilter);
        crit.setFetchMode("tstamp", FetchMode.EAGER);
        crit.setProjection(Projections.property("tstamp"));
        return crit.list();
    }
View Full Code Here


        CriteriaBuilder cb = new CriteriaBuilder();
        Criteria crit = getSession().createCriteria(HBpelEvent.class);
        if (efilter != null)
            cb.buildCriteria(crit, efilter);
        if (ifilter != null)
            cb.buildCriteria(crit.createCriteria("instance"), ifilter);
        List<HBpelEvent> hevents = crit.list();
        List<BpelEvent> ret = new ArrayList<BpelEvent>(hevents.size());
        try {
            CollectionsX.transformEx(ret, hevents, new UnaryFunctionEx<HBpelEvent, BpelEvent>() {
                public BpelEvent apply(HBpelEvent x) throws Exception {
View Full Code Here

    s.save(l);
    assertTrue( l==s.createCriteria(Top.class).uniqueResult() );
    s.delete(l);
    s.flush();
    Criteria c = s.createCriteria(Lower.class);
    c.createCriteria("yetanother")
      .add( Restrictions.isNotNull("id") )
      .createCriteria("another");
    c.createCriteria("another").add( Restrictions.isNotNull("id") );
    c.list();
    t.commit();
View Full Code Here

    s.flush();
    Criteria c = s.createCriteria(Lower.class);
    c.createCriteria("yetanother")
      .add( Restrictions.isNotNull("id") )
      .createCriteria("another");
    c.createCriteria("another").add( Restrictions.isNotNull("id") );
    c.list();
    t.commit();
    s.close();
  }
View Full Code Here

    s.close();

    s = openSession();
    tx = s.beginTransaction();
    Criteria crit = s.createCriteria( Life.class );
    crit.createCriteria( "owner" ).add( Expression.eq( "name", "kitty" ) );
    life = (Life) crit.uniqueResult();
    assertEquals( "Long long description", life.fullDescription );
    s.delete( life.owner );
    s.delete( life );
    tx.commit();
View Full Code Here

    baz.setFooArray( new FooProxy[] { foo1 } );

    LockMode lockMode = (getDialect() instanceof DB2Dialect) ? LockMode.READ : LockMode.UPGRADE;

    Criteria crit = s.createCriteria(Baz.class);
    crit.createCriteria("topGlarchez")
      .add( Restrictions.isNotNull("name") )
      .createCriteria("proxyArray")
        .add( Restrictions.eqProperty("name", "name") )
        .add( Restrictions.eq("name", "g2") )
        .add( Restrictions.gt("x", new Integer(-666) ) );
View Full Code Here

      .add( Restrictions.isNotNull("name") )
      .createCriteria("proxyArray")
        .add( Restrictions.eqProperty("name", "name") )
        .add( Restrictions.eq("name", "g2") )
        .add( Restrictions.gt("x", new Integer(-666) ) );
    crit.createCriteria("fooSet")
      .add( Restrictions.isNull("null") )
      .add( Restrictions.eq("string", "a string") )
      .add( Restrictions.lt("integer", new Integer(-665) ) );
    crit.createCriteria("fooArray")
        // this is the bit causing the problems; creating the criteria on fooArray does not add it to FROM,
View Full Code Here

        .add( Restrictions.gt("x", new Integer(-666) ) );
    crit.createCriteria("fooSet")
      .add( Restrictions.isNull("null") )
      .add( Restrictions.eq("string", "a string") )
      .add( Restrictions.lt("integer", new Integer(-665) ) );
    crit.createCriteria("fooArray")
        // this is the bit causing the problems; creating the criteria on fooArray does not add it to FROM,
        // and so restriction below leads to an invalid reference.
      .add( Restrictions.eq("string", "a string") )
      .setLockMode(lockMode);
View Full Code Here

    s = openSession();
    t = s.beginTransaction();

    crit = s.createCriteria(Baz.class)
      .setLockMode(lockMode);
    crit.createCriteria("topGlarchez")
      .add( Restrictions.gt( "x", new Integer(-666) ) );
    crit.createCriteria("fooSet")
      .add( Restrictions.isNull("null") );
    list = crit.list();
View Full Code Here

    crit = s.createCriteria(Baz.class)
      .setLockMode(lockMode);
    crit.createCriteria("topGlarchez")
      .add( Restrictions.gt( "x", new Integer(-666) ) );
    crit.createCriteria("fooSet")
      .add( Restrictions.isNull("null") );
    list = crit.list();

    assertTrue( list.size()==4 );
    baz = (Baz) crit.uniqueResult();
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.