Package org.hibernate.classic

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


    newSubCat.getSubcategories().remove(cat);
    s.delete(cat);
    s.delete(subCatBaz);
    s.delete(catWA);
    s.flush();
    s.connection().commit();
    s.close();

  }

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


    Session s = openSession();

    s.save(p);
    s.flush();

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

    getSessions().evict(Role.class);
    s = openSession();
View Full Code Here

    assertTrue(p2.getName().equalsIgnoreCase(p.getName()));
    s.delete(p2);
    s.flush();


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


  }
View Full Code Here

    s.save(m.getPrescribedDrug());
    s.save(m);

    s.flush();
    s.connection().commit();
    s.close();
    s = openSession();

    Medication m2  = (Medication) s.get(Medication.class, m.getId());
    assertNotSame(m, m2);
View Full Code Here

    Medication m2  = (Medication) s.get(Medication.class, m.getId());
    assertNotSame(m, m2);

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

  }

//  public void testCollectionCUD() throws HibernateException, SQLException {
View Full Code Here

  }

  public void testLoadAfterNonExists() throws HibernateException, SQLException {
    Session session = openSession();
    if ( ( getDialect() instanceof MySQLDialect ) || ( getDialect() instanceof IngresDialect ) ) {
      session.connection().setTransactionIsolation( Connection.TRANSACTION_READ_COMMITTED );
    }
    session.getTransaction().begin();

    // First, prime the fixture session to think the entity does not exist
    try {
View Full Code Here

    j.setType( 'x' );
    j.setAmount( 1.0f );
    Serializable iid = s.save(i);
    Serializable jid = s.save(j);
    s.flush();
    s.connection().commit();
    s.close();

    getSessions().evict(I.class);

    s = getSessions().openSession();
View Full Code Here

    i = (I) s.get(I.class, iid);
    assertTrue( i.getClass()==I.class );
    j.setAmount( 0.5f );
    s.lock(i, LockMode.UPGRADE);
    s.flush();
    s.connection().commit();
    s.close();

    s = getSessions().openSession();
    j = (J) s.get(I.class, jid, LockMode.UPGRADE);
    i = (I) s.get(I.class, iid, LockMode.UPGRADE);
View Full Code Here

    s = getSessions().openSession();
    j = (J) s.get(I.class, jid, LockMode.UPGRADE);
    i = (I) s.get(I.class, iid, LockMode.UPGRADE);
    s.flush();
    s.connection().commit();
    s.close();

    s = getSessions().openSession();
    assertTrue( s.createQuery( "from I" ).list().size()==2 );
    assertTrue( s.createQuery( "from J" ).list().size()==1 );
View Full Code Here

    s = getSessions().openSession();
    assertTrue( s.createQuery( "from I" ).list().size()==2 );
    assertTrue( s.createQuery( "from J" ).list().size()==1 );
    assertTrue( s.createQuery( "from I i where i.class = 0" ).list().size()==1 );
    assertTrue( s.createQuery( "from I i where i.class = 1" ).list().size()==1 );
    s.connection().commit();
    s.close();

    s = getSessions().openSession();
    j = (J) s.get(J.class, jid);
    i = (I) s.get(I.class, iid);
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.