Package org.hibernate.classic

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


     query.setString(0, "my id");
     list = query.list();

     assertTrue(list.size()==1);

     session.clear();

     query = session.createSQLQuery("select s.id as {sing.id}, s.string_ as {sing.string}, s.prop as {sing.prop} from Single s where s.id = ?", "sing", Single.class);
     query.setString(0, "my id");
     list = query.list();
View Full Code Here


     query.setString(0, "my id");
     list = query.list();

     assertTrue(list.size()==1);

     session.clear();

     query = session.createSQLQuery("select s.id as {sing.id}, s.string_ as {sing.string}, s.prop as {sing.prop} from Single s where s.id = ?", "sing", Single.class);
     query.setString(0, "my id");
     list = query.list();
View Full Code Here

    Session s = openSession();
    s.enableFilter( "region" ).setParameter( "userRegion", "US" );
    Transaction t = s.beginTransaction();

    prepareTestData( s );
    s.clear();

    List results;
    Iterator itr;

    results = s.createQuery( "from Person" ).list();
View Full Code Here

    List results;
    Iterator itr;

    results = s.createQuery( "from Person" ).list();
    assertEquals( "Incorrect qry result count", 4, results.size() );
    s.clear();

    results = s.createQuery( "from Employee" ).list();
    assertEquals( "Incorrect qry result count", 2, results.size() );
    s.clear();
View Full Code Here

    assertEquals( "Incorrect qry result count", 4, results.size() );
    s.clear();

    results = s.createQuery( "from Employee" ).list();
    assertEquals( "Incorrect qry result count", 2, results.size() );
    s.clear();

    results = new ArrayList( new HashSet( s.createQuery( "from Person as p left join fetch p.minions" ).list() ) );
    assertEquals( "Incorrect qry result count", 4, results.size() );
    itr = results.iterator();
    while ( itr.hasNext() ) {
View Full Code Here

        Employee john = ( Employee ) p;
        assertEquals( "Incorrect fecthed minions count", 1, john.getMinions().size() );
        break;
      }
    }
    s.clear();

    results = new ArrayList( new HashSet( s.createQuery( "from Employee as p left join fetch p.minions" ).list() ) );
    assertEquals( "Incorrect qry result count", 2, results.size() );
    itr = results.iterator();
    while ( itr.hasNext() ) {
View Full Code Here

    Session s = openSession();
    s.enableFilter( "region" ).setParameter( "userRegion", "US" );
    Transaction t = s.beginTransaction();

    prepareTestData( s );
    s.clear();

    List results = s.createQuery( "from Person" ).list();
    assertEquals( "Incorrect qry result count", 4, results.size() );
    s.clear();
View Full Code Here

    prepareTestData( s );
    s.clear();

    List results = s.createQuery( "from Person" ).list();
    assertEquals( "Incorrect qry result count", 4, results.size() );
    s.clear();

    results = s.createQuery( "from Employee" ).list();
    assertEquals( "Incorrect qry result count", 2, results.size() );
    Iterator itr = results.iterator();
    while ( itr.hasNext() ) {
View Full Code Here

        Employee john = ( Employee ) p;
        assertEquals( "Incorrect fecthed minions count", 2, john.getMinions().size() );
        break;
      }
    }
    s.clear();

    // TODO : currently impossible to define a collection-level filter w/ joined-subclass elements that will filter based on a superclass column and function correctly in (theta only?) outer joins;
    // this is consistent with the behaviour of a collection-level where.
    // this might be one argument for "pulling" the attached class-level filters into collection assocations,
    // although we'd need some way to apply the appropriate alias in that scenario.
View Full Code Here

        Employee john = ( Employee ) p;
        assertEquals( "Incorrect fecthed minions count", 2, john.getMinions().size() );
        break;
      }
    }
    s.clear();

    results = new ArrayList( new HashSet( s.createQuery( "from Employee as p left join fetch p.minions" ).list() ) );
    assertEquals( "Incorrect qry result count", 2, results.size() );
    itr = results.iterator();
    while ( itr.hasNext() ) {
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.