Package org.hibernate.classic

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


    s.delete(m);
    s.delete( s.load(Master.class, m0id) );

    s.flush();
    s.connection().commit();
    s.close();
  }

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


  public void testNamedQuery() throws Exception {
    Session s = openSession();
    Query q = s.getNamedQuery("all_details");
    q.list();
    s.connection().commit();
    s.close();
  }

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

    s.save(d1);
    s.save(d2);
    m.addDetail(d1);
    m.addDetail(d2);
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();
    m = (Master) s.load(Master.class, mid);
    s.connection().commit();
View Full Code Here

    s.connection().commit();
    s.close();

    s = openSession();
    m = (Master) s.load(Master.class, mid);
    s.connection().commit();
    s.close();
    m.setName("New Name");
    s = openSession();
    s.update(m, mid);
    Iterator iter = m.getDetails().iterator();
View Full Code Here

    assertTrue(i==2);
    iter = m.getDetails().iterator();
    while ( iter.hasNext() ) s.delete( iter.next() );
    s.delete(m);
    s.flush();
    s.connection().commit();
    s.close();
  }

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

    l.add(c);
    assn.setCategories(l);
    c.setAssignable(assn);
    s.save(assn);
    s.flush();
    s.connection().commit();
    s.close();
    s = openSession();
    s.delete(assn);
    s.flush();
    s.connection().commit();
View Full Code Here

    s.connection().commit();
    s.close();
    s = openSession();
    s.delete(assn);
    s.flush();
    s.connection().commit();
    s.close();
  }

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

    c.getSubcategories().add(c2);
    c2.getSubcategories().add(null);
    c2.getSubcategories().add(c3);
    s.save(c);
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();
    Transaction tx = s.beginTransaction();
    s.lock(c, LockMode.UPGRADE);
View Full Code Here

    s.close();

    s = openSession();
    loaded = (Category) s.load( Category.class, new Long( c.getId() ) );
    assertFalse( Hibernate.isInitialized( loaded.getSubcategories() ) );
    s.connection().commit();
    s.close();
    s = openSession();
    s.lock(loaded, LockMode.NONE);
    assertTrue( loaded.getSubcategories().size()==2 );
    s.connection().commit();
View Full Code Here

    s.connection().commit();
    s.close();
    s = openSession();
    s.lock(loaded, LockMode.NONE);
    assertTrue( loaded.getSubcategories().size()==2 );
    s.connection().commit();
    s.close();


    s = openSession();
    c = (Category) s.load( Category.class, new Long( c.getId() ) );
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.