Package org.hibernate.classic

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


    s.close();
    s = openSession();
    Nameable n = (Nameable) s.load(Nameable.class, id);
    s.delete(n);
    s.flush();
    s.connection().commit();
    s.close();
  }

  public void testNoUpdateManyToOne() throws Exception {
    Session s = openSession();
View Full Code Here


    z.setW(w1);
    s.save(z);
    s.flush();
    z.setW(w2);
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();
    s.update(z);
    s.flush();
View Full Code Here

    s.update(z);
    s.flush();
    s.delete(z);
    s.delete("from W");
    s.flush();
    s.connection().commit();
    s.close();
  }

  public void testQueuedBagAdds() throws Exception {
    Session s = openSession();
View Full Code Here

    Category c = new Category();
    c.setAssignable(a);
    a.getCategories().add(c);
    s.save(a);
    s.flush();
    s.connection().commit();
    s.close();

    getSessions().evictCollection("org.hibernate.test.legacy.Assignable.categories");

    s = openSession();
View Full Code Here

    c.setAssignable(a);
    a.getCategories().add(c);
    assertFalse( Hibernate.isInitialized( a.getCategories() ) );
    assertTrue( a.getCategories().size()==2 );
    s.flush();
    s.connection().commit();
    s.close();

    getSessions().evictCollection("org.hibernate.test.legacy.Assignable.categories");

    s = openSession();
View Full Code Here

    a.getCategories().add(c);
    assertFalse( Hibernate.isInitialized( a.getCategories() ) );
    s.flush();
    assertFalse( Hibernate.isInitialized( a.getCategories() ) );
    assertTrue( a.getCategories().size()==3 );
    s.connection().commit();
    s.close();

    getSessions().evictCollection("org.hibernate.test.legacy.Assignable.categories");

    s = openSession();
View Full Code Here

    s = openSession();
    a = (Assignable) s.get(Assignable.class, "foo");
    assertTrue( a.getCategories().size()==3 );
    s.delete(a);
    s.flush();
    s.connection().commit();
    s.close();

  }

  public void testPolymorphicCriteria() throws Exception {
View Full Code Here

    master1.addIncoming(master3);
    master3.addOutgoing(master1);
    Serializable m1id = s.getIdentifier(master1);
    assertTrue( s.createFilter( master1.getIncoming(), "where this.id > 0 and this.name is not null" ).list().size()==2 );
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();
    master1 = (Master) s.load(Master.class, m1id);
    Iterator iter = master1.getIncoming().iterator();
View Full Code Here

      i++;
    }
    assertTrue( "incoming-outgoing", i==2 );
    s.delete(master1);
    s.flush();
    s.connection().commit();
    s.close();
  }

  public void testCascading() throws Exception {
View Full Code Here

    d1.setMaster(m0); d2.setMaster(m0);
    m.getMoreDetails().add(d1);
    m.getMoreDetails().add(d2);
    Serializable mid = s.save(m);
    s.flush();
    s.connection().commit();
    s.close();
    s = openSession();
    m = (Master) s.load(Master.class, mid);
    assertTrue( "cascade save", m.getMoreDetails().size()==2 );
    assertTrue( "cascade save", ( (Detail) m.getMoreDetails().iterator().next() ).getMaster().getDetails().size()==2 );
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.