Package org.hibernate.classic

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


    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

    assertEquals( 1, count );
    BooleanLiteralEntity entity = ( BooleanLiteralEntity ) s.createQuery( "from BooleanLiteralEntity" ).uniqueResult();
    assertTrue( entity.isYesNoBoolean() );
    assertTrue( entity.isTrueFalseBoolean() );
    assertTrue( entity.isZeroOneBoolean() );
    s.clear();

    count = s.createQuery( "update BooleanLiteralEntity set yesNoBoolean = true, trueFalseBoolean = true, zeroOneBoolean = true" )
        .executeUpdate();
    assertEquals( 1, count );
    entity = ( BooleanLiteralEntity ) s.createQuery( "from BooleanLiteralEntity" ).uniqueResult();
View Full Code Here

        object.setDate3(testvalue3);
        s.save( object, new Long(10));
        t.commit();
        s.close();
        s = openSession();
        s.clear();
        t = s.beginTransaction();
        TestInterSystemsFunctionsClass test = (TestInterSystemsFunctionsClass) s.get(TestInterSystemsFunctionsClass.class, new Long(10));
        assertTrue( test.getDate1().equals(testvalue));
        test = (TestInterSystemsFunctionsClass) s.get(TestInterSystemsFunctionsClass.class, new Long(10), LockMode.UPGRADE);
        assertTrue( test.getDate1().equals(testvalue));
View Full Code Here

    Session s = openSession();
    s.beginTransaction();
    Glarch g = new Glarch();
    Serializable gid = s.save(g);
    s.flush();
    s.clear();
    GlarchProxy gp = (GlarchProxy) s.load(Glarch.class, gid);
    gp.getName(); //force init
    s.refresh(gp);
    s.delete(gp);
    s.flush();
View Full Code Here

    Foo foo1 = new Foo();
    s.save(foo1);
    baz.setFooArray( new FooProxy[] { foo1 } );

    s.flush();
    s.clear();

    baz = ( Baz ) s.createQuery("from Baz b left join fetch b.fooArray").uniqueResult();
    assertEquals( 1, baz.getFooArray().length );

    t.rollback();
View Full Code Here

    Foo foo1 = new Foo();
    s.save(foo1);
    baz.setFooArray( new FooProxy[] { foo1 } );

    s.flush();
    s.clear();

    baz = ( Baz ) s.createCriteria(Baz.class).createCriteria( "fooArray" ).uniqueResult();
    assertEquals( 1, baz.getFooArray().length );

    t.rollback();
View Full Code Here

    Foo foo1 = new Foo();
    s.save(foo1);
    baz.setFoo( foo1 );

    s.flush();
    s.clear();

    baz = ( Baz ) s.createQuery("from Baz b").uniqueResult();
    assertFalse( Hibernate.isInitialized( baz.getFoo() ) );
    assertTrue( baz.getFoo() instanceof HibernateProxy );
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.