Package org.hibernate.classic

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


        id.setSystem("c64");
        id.setId("games");

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

        s = openSession();
        // having a composite id with one property named id works since the map used by sqlloader to map names to properties handles it.
        Query query = s.createSQLQuery("select system as {c.system}, id as {c.id}, name as {c.name}, foo as {c.composite.foo}, bar as {c.composite.bar} from CompositeIdId where system=? and id=?", "c", CompositeIdId.class);
View Full Code Here


        CompositeIdId id2 = (CompositeIdId) query.uniqueResult();
        check(id, id2);

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

        s = openSession();

        CompositeIdId useForGet = new CompositeIdId();
View Full Code Here

        // this doesn't work since the verification does not take column span into respect!
        CompositeIdId getted = (CompositeIdId) s.get(CompositeIdId.class, useForGet);
        check(id,getted);


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

    }

    private void check(CompositeIdId id, CompositeIdId id2) {
View Full Code Here

    System.out.println(k + "=" + i.getParent());
    assertTrue( i.getParent()==k );
    assertTrue( j.getParent()==k );
    assertTrue( k.getIs().size()==2 );
    s.flush();
    s.connection().commit();
    s.close();

    getSessions().evict(I.class);

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

    s = getSessions().openSession();
    assertTrue( s.createQuery( "from K k inner join k.is i where i.name = 'j'" ).list().size()==1 );
    assertTrue( s.createQuery( "from K k inner join k.is i where i.name = 'i'" ).list().size()==1 );
    assertTrue( s.createQuery( "from K k left join fetch k.is" ).list().size()==2 );
    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

    k = (K) s.get(K.class, kid);
    s.delete(k);
    s.delete(j);
    s.delete(i);
    s.flush();
    s.connection().commit();
    s.close();

  }
}
View Full Code Here

    s.refresh(b);
    //b.getBlob().setBytes( 2, "abc".getBytes() );
    b.getClob().getSubString(2, 3);
    //b.getClob().setString(2, "abc");
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();
    b = (Blobber) s.load( Blobber.class, new Integer( b.getId() ) );
    Blobber b2 = new Blobber();
View Full Code Here

    b.setBlob(null);
    //assertTrue( b.getClob().getSubString(1, 3).equals("fab") );
    b.getClob().getSubString(1, 6);
    //b.getClob().setString(1, "qwerty");
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();
    b = (Blobber) s.load( Blobber.class, new Integer( b.getId() ) );
    b.setClob( s.getLobHelper().createClob("xcvfxvc xcvbx cvbx cvbx cvbxcvbxcvbxcvb") );
View Full Code Here

    s = openSession();
    b = (Blobber) s.load( Blobber.class, new Integer( b.getId() ) );
    b.setClob( s.getLobHelper().createClob("xcvfxvc xcvbx cvbx cvbx cvbxcvbxcvbxcvb") );
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();
    b = (Blobber) s.load( Blobber.class, new Integer( b.getId() ) );
    assertTrue( b.getClob().getSubString(1, 7).equals("xcvfxvc") );
View Full Code Here

    s = openSession();
    b = (Blobber) s.load( Blobber.class, new Integer( b.getId() ) );
    assertTrue( b.getClob().getSubString(1, 7).equals("xcvfxvc") );
    //b.getClob().setString(5, "1234567890");
    s.flush();
    s.connection().commit();
    s.close();


    /*InputStream is = getClass().getClassLoader().getResourceAsStream("jdbc20.pdf");
    s = sessionsopenSession();
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.