Java 类org.hibernate.connection.DriverManagerConnectionProvider 实例源码

项目:cacheonix-core    文件:FooBarTest.java   
public void testUserProvidedConnection() throws Exception {
    ConnectionProvider dcp = new DriverManagerConnectionProvider();
    dcp.configure( Environment.getProperties() );
    Session s = getSessions().openSession( dcp.getConnection() );
    Transaction tx = s.beginTransaction();
    s.find("from Fo");
    tx.commit();
    Connection c = s.disconnect();
    assertTrue( c!=null );
    s.reconnect(c);
    tx = s.beginTransaction();
    s.find("from Fo");
    tx.commit();
    assertTrue( s.close()==c );
    c.close();
}