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


    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

    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

   
    s = openSession();
    t = s.beginTransaction();
    d = (D) s.get(D.class, did);
    assertTrue(d.getReverse().getId().equals(did));
    s.clear();
    getSessions().evict(D.class);
    getSessions().evict(A.class);
    d = (D) s.get(D.class, did);
    assertTrue(d.inverse.getId().equals(did));
    assertTrue(d.inverse.getName().equals("a"));
View Full Code Here

    getSessions().evict(D.class);
    getSessions().evict(A.class);
    d = (D) s.get(D.class, did);
    assertTrue(d.inverse.getId().equals(did));
    assertTrue(d.inverse.getName().equals("a"));
    s.clear();
    getSessions().evict(D.class);
    getSessions().evict(A.class);
    assertTrue( s.find("from D d join d.reverse r join d.inverse i where i = r").size()==1 );
    t.commit();
    s.close();
View Full Code Here

   
    s = openSession();
    t = s.beginTransaction();
    d = (D) s.get(D.class, did);
    assertTrue(d.getReverse().getId().equals(did));
    s.clear();
    getSessions().evict(D.class);
    getSessions().evict(A.class);
    d = (D) s.get(D.class, did);
    assertTrue(d.inverse.getId().equals(did));
    assertTrue(d.inverse.getName().equals("a"));
View Full Code Here

    getSessions().evict(D.class);
    getSessions().evict(A.class);
    d = (D) s.get(D.class, did);
    assertTrue(d.inverse.getId().equals(did));
    assertTrue(d.inverse.getName().equals("a"));
    s.clear();
    getSessions().evict(D.class);
    getSessions().evict(A.class);
    assertTrue( s.find("from D d join d.reverse r join d.inverse i where i = r").size()==1 );
    t.commit();
    s.close();
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

    order.getItems().add(new Item());
    session.save(order);
    session.flush();
    // Otherwise the query returns the existing order (and we didn't set the
    // parent in the item)...
    session.clear();
    Order other = (Order) session.get(Order.class, order.getId());
    assertEquals(1, other.getItems().size());
    assertEquals(other, other.getItems().iterator().next().getOrder());
  }
View Full Code Here

    order.getItems().add(item);
    session.save(order);
    session.flush();
    // Otherwise the query returns the existing order (and we didn't set the
    // parent in the item)...
    session.clear();
    Order other = (Order) session
        .createQuery( "select o from Order o join o.items i where i.product=:product")
        .setString("product", "foo").uniqueResult();
    assertEquals(1, other.getItems().size());
    assertEquals(other, other.getItems().iterator().next().getOrder());
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.