Package org.hibernate

Examples of org.hibernate.Session.connection()


  protected boolean readCommittedIsolationMaintained(String scenario) {
    int isolation = java.sql.Connection.TRANSACTION_READ_UNCOMMITTED;
    Session testSession = null;
    try {
      testSession = openSession();
      isolation = testSession.connection().getTransactionIsolation();
    }
    catch( Throwable ignore ) {
    }
    finally {
      if ( testSession != null ) {
View Full Code Here


    try {
      DummyTransactionManager.INSTANCE.begin();
      s = getSessions().getCurrentSession();
      s.createQuery( "from Item" ).scroll().next();
      s.connection();
      DummyTransactionManager.INSTANCE.getTransaction().commit();
    }
    finally {
      DummyTransactionManager.INSTANCE.begin();
      s = openSession();
View Full Code Here

  public void afterSessionFactoryBuilt(SessionFactoryImplementor sfi) {
    super.afterSessionFactoryBuilt( sfi );
    Session session = null;
    try {
      session = sfi.openSession();
      Statement stat = session.connection().createStatement();
      stat.execute("CREATE SCHEMA sb AUTHORIZATION DBA ");
      stat.execute(" CREATE SCHEMA sa AUTHORIZATION DBA ");
      stat.execute(" CREATE TABLE \"SA\".\"Team\" (test INTEGER) ");
      stat.close();
    }
View Full Code Here

    SchemaExport se = new SchemaExport(getCfg());
    se.create(true,true);
   
    // here we modify the generated table in order to test SchemaUpdate
    Session session = openSession();
    Connection conn = session.connection();
    Statement stat = conn.createStatement();
    stat.execute("ALTER TABLE \"SB\".\"Team\" DROP COLUMN name ");
   
    // update schema
    SchemaUpdate su = new SchemaUpdate(getCfg());
View Full Code Here

    SchemaExport se = new SchemaExport(getCfg());
    se.create(true,true);
   
    // here we drop the table generated for TeamView and create a view in order to test View validation
    Session session = openSession();
    Connection conn = session.connection();
    Statement stat = conn.createStatement();
    stat.execute("DROP TABLE \"SB\".\"TeamView\" ");
    stat.execute("CREATE VIEW \"SB\".\"TeamView\" AS SELECT \"iD\",name, name as duplicatedname FROM \"SB\".\"Team\"");
   
View Full Code Here

    SchemaExport se = new SchemaExport(getCfg());
    se.create(true,true);
   
    // here we modify the generated table in order to test SchemaUpdate
    Session session = openSession();
    Connection conn = session.connection();
    Statement stat = conn.createStatement();
    stat.execute("ALTER TABLE \"SB\".\"TEAM\" DROP COLUMN xname ");
   
    // update schema
    SchemaUpdate su = new SchemaUpdate(getCfg());
View Full Code Here

    SchemaExport se = new SchemaExport(getCfg());
    se.create(true,true);
   
    // here we modify the generated table in order to test SchemaUpdate
    Session session = openSession();
    Connection conn = session.connection();
    Statement stat = conn.createStatement();
    stat.execute("ALTER TABLE \"SB\".\"Team\" DROP COLUMN name ");
   
    // update schema
    //SchemaUpdate su = new SchemaUpdate(getCfg());
View Full Code Here

    SchemaExport se = new SchemaExport(getCfg());
    se.create(true,true);
   
    // here we modify the generated table in order to test SchemaUpdate
    Session session = openSession();
    Connection conn = session.connection();
    Statement stat = conn.createStatement();
    stat.execute("ALTER TABLE \"SB\".\"TEAM\" DROP COLUMN xname ");
   
    // update schema
    //SchemaUpdate su = new SchemaUpdate(getCfg());
View Full Code Here

    // this will cause the connection manager to cycle through the aggressive release logic;
    // it should not release the connection since we explicitly suplied it ourselves.
    session.flush();

    assertTrue( "Different connections", originalConnection == session.connection() );

    session.delete( silly );
    session.flush();

    release( session );
View Full Code Here

  public void testBorrowedConnections() throws Throwable {
    prepare();
    Session s = getSessionUnderTest();

    Connection conn = s.connection();
    assertTrue( ( ( SessionImpl ) s ).getJDBCContext().getConnectionManager().hasBorrowedConnection() );
    conn.close();
    assertFalse( ( ( SessionImpl ) s ).getJDBCContext().getConnectionManager().hasBorrowedConnection() );

    release( s );
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.