Package org.hibernate.classic

Examples of org.hibernate.classic.Session.find()


    list = s.find("from Foo foo where foo.string='osama bin laden' and foo.boolean = true order by foo.string asc, foo.component.count desc");
    assertTrue( "empty query", list.size()==0 );
    Iterator iter = s.iterate("from Foo foo where foo.string='osama bin laden' order by foo.string asc, foo.component.count desc");
    assertTrue( "empty iterator", !iter.hasNext() );

    list = s.find("select foo.foo from Foo foo");
    assertTrue( "query", list.size()==1 );
    assertTrue( "returned object", list.get(0)==foo.getFoo() );
    foo.getFoo().setFoo(foo);
    foo.setString("fizard");
    //The following test is disabled for databases with no subselects...also for Interbase (not sure why).
View Full Code Here


        !(getDialect() instanceof PointbaseDialect) &&
        !(getDialect() instanceof DerbyDialect)
    )  {
      // && !db.equals("weblogic") {
      if ( !( getDialect() instanceof InterbaseDialect ) ) {
        list = s.find("from Foo foo where ? = some elements(foo.component.importantDates)", new Date(), Hibernate.DATE);
        assertTrue( "component query", list.size()==2 );
      }
      if( !( getDialect() instanceof TimesTenDialect)) {
        list = s.find("from Foo foo where size(foo.component.importantDates) = 3"); //WAS: 4
        assertTrue( "component query", list.size()==2 );
View Full Code Here

      if ( !( getDialect() instanceof InterbaseDialect ) ) {
        list = s.find("from Foo foo where ? = some elements(foo.component.importantDates)", new Date(), Hibernate.DATE);
        assertTrue( "component query", list.size()==2 );
      }
      if( !( getDialect() instanceof TimesTenDialect)) {
        list = s.find("from Foo foo where size(foo.component.importantDates) = 3"); //WAS: 4
        assertTrue( "component query", list.size()==2 );
        list = s.find("from Foo foo where 0 = size(foo.component.importantDates)");
        assertTrue( "component query", list.size()==0 );
      }
      list = s.find("from Foo foo where exists elements(foo.component.importantDates)");
View Full Code Here

        assertTrue( "component query", list.size()==2 );
      }
      if( !( getDialect() instanceof TimesTenDialect)) {
        list = s.find("from Foo foo where size(foo.component.importantDates) = 3"); //WAS: 4
        assertTrue( "component query", list.size()==2 );
        list = s.find("from Foo foo where 0 = size(foo.component.importantDates)");
        assertTrue( "component query", list.size()==0 );
      }
      list = s.find("from Foo foo where exists elements(foo.component.importantDates)");
      assertTrue( "component query", list.size()==2 );
      s.find("from Foo foo where not exists (from Bar bar where bar.id = foo.id)");
View Full Code Here

        list = s.find("from Foo foo where size(foo.component.importantDates) = 3"); //WAS: 4
        assertTrue( "component query", list.size()==2 );
        list = s.find("from Foo foo where 0 = size(foo.component.importantDates)");
        assertTrue( "component query", list.size()==0 );
      }
      list = s.find("from Foo foo where exists elements(foo.component.importantDates)");
      assertTrue( "component query", list.size()==2 );
      s.find("from Foo foo where not exists (from Bar bar where bar.id = foo.id)");

      s.find("select foo.foo from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long)");
      s.find("select foo.foo from Foo foo where foo = some(from Foo x where (x.long > foo.foo.long))");
View Full Code Here

        list = s.find("from Foo foo where 0 = size(foo.component.importantDates)");
        assertTrue( "component query", list.size()==0 );
      }
      list = s.find("from Foo foo where exists elements(foo.component.importantDates)");
      assertTrue( "component query", list.size()==2 );
      s.find("from Foo foo where not exists (from Bar bar where bar.id = foo.id)");

      s.find("select foo.foo from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long)");
      s.find("select foo.foo from Foo foo where foo = some(from Foo x where (x.long > foo.foo.long))");
      if ( !( getDialect() instanceof TimesTenDialect)) {
        s.find("select foo.foo from Foo foo where foo.long = some( select max(x.long) from Foo x where (x.long > foo.foo.long) group by x.foo )");
View Full Code Here

      }
      list = s.find("from Foo foo where exists elements(foo.component.importantDates)");
      assertTrue( "component query", list.size()==2 );
      s.find("from Foo foo where not exists (from Bar bar where bar.id = foo.id)");

      s.find("select foo.foo from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long)");
      s.find("select foo.foo from Foo foo where foo = some(from Foo x where (x.long > foo.foo.long))");
      if ( !( getDialect() instanceof TimesTenDialect)) {
        s.find("select foo.foo from Foo foo where foo.long = some( select max(x.long) from Foo x where (x.long > foo.foo.long) group by x.foo )");
      }
      s.find("from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long) and foo.foo.string='baz'");
View Full Code Here

      list = s.find("from Foo foo where exists elements(foo.component.importantDates)");
      assertTrue( "component query", list.size()==2 );
      s.find("from Foo foo where not exists (from Bar bar where bar.id = foo.id)");

      s.find("select foo.foo from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long)");
      s.find("select foo.foo from Foo foo where foo = some(from Foo x where (x.long > foo.foo.long))");
      if ( !( getDialect() instanceof TimesTenDialect)) {
        s.find("select foo.foo from Foo foo where foo.long = some( select max(x.long) from Foo x where (x.long > foo.foo.long) group by x.foo )");
      }
      s.find("from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long) and foo.foo.string='baz'");
      s.find("from Foo foo where foo.foo.string='baz' and foo = some(select x from Foo x where x.long > foo.foo.long)");
View Full Code Here

      s.find("from Foo foo where not exists (from Bar bar where bar.id = foo.id)");

      s.find("select foo.foo from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long)");
      s.find("select foo.foo from Foo foo where foo = some(from Foo x where (x.long > foo.foo.long))");
      if ( !( getDialect() instanceof TimesTenDialect)) {
        s.find("select foo.foo from Foo foo where foo.long = some( select max(x.long) from Foo x where (x.long > foo.foo.long) group by x.foo )");
      }
      s.find("from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long) and foo.foo.string='baz'");
      s.find("from Foo foo where foo.foo.string='baz' and foo = some(select x from Foo x where x.long > foo.foo.long)");
      s.find("from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long)");
View Full Code Here

      s.find("select foo.foo from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long)");
      s.find("select foo.foo from Foo foo where foo = some(from Foo x where (x.long > foo.foo.long))");
      if ( !( getDialect() instanceof TimesTenDialect)) {
        s.find("select foo.foo from Foo foo where foo.long = some( select max(x.long) from Foo x where (x.long > foo.foo.long) group by x.foo )");
      }
      s.find("from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long) and foo.foo.string='baz'");
      s.find("from Foo foo where foo.foo.string='baz' and foo = some(select x from Foo x where x.long > foo.foo.long)");
      s.find("from Foo foo where foo = some(select x from Foo x where x.long > foo.foo.long)");

      s.iterate("select foo.string, foo.date, foo.foo.string, foo.id from Foo foo, Baz baz where foo in elements(baz.fooArray) and foo.string like 'foo'");
    }
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.