Package org.hibernate.classic

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


  public void testRefreshProxy() throws Exception {
    Session s = openSession();
    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


  public void testRefreshProxy() throws Exception {
    Session s = openSession();
    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

    List list = namedQuery.list();
   
    assertEquals(1, list.size());
    assertEquals( "flakky comp", ( (Componentizable) list.get(0) ).getComponent().getName() );
   
    session.clear();
   
    session.delete(componentizable);
    session.flush();
   
    session.connection().commit();
View Full Code Here

    else {
      assertSame(a2, savedB);
      assertSame(a1, savedA);
    }

    session.clear();
    List list2 = session.getNamedQuery("propertyResultDiscriminator").list();
    assertEquals(2, list2.size());
   
    session.connection().commit();
    session.close();
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

    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

    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

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.