Package org.hibernate

Examples of org.hibernate.Session.connection()


    if (this.prepareConnection && session.isConnected() && isSameConnectionForEntireSession(session)) {
      // We're running with connection release mode "on_close": We're able to reset
      // the isolation level and/or read-only flag of the JDBC Connection here.
      // Else, we need to rely on the connection pool to perform proper cleanup.
      try {
        Connection con = session.connection();
        DataSourceUtils.resetConnectionAfterTransaction(con, txObject.getPreviousIsolationLevel());
      }
      catch (HibernateException ex) {
        logger.debug("Could not access JDBC Connection of Hibernate Session", ex);
      }
View Full Code Here


  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

  public void afterSessionFactoryBuilt(SessionFactoryImplementor sfi) {
    super.afterSessionFactoryBuilt( sfi );
    Session session = null;
    try {
      session = sfi.openSession();
      Statement st = session.connection().createStatement();
      try {
        st.execute( "drop table Point");
      }
      catch( Throwable ignore ) {
        // ignore
View Full Code Here

    }
    catch( Throwable ignore ) {
    }

    try {
      s.connection();
      fail( "allowed to access connection on closed session" );
    }
    catch( Throwable ignore ) {
    }
View Full Code Here

  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

    // @todo localize
    recipients.put(email, firstName + ' ' + lastName);
      } // end of while

      it = null;
      Connection conn = hsession.connection();
      ArrayList notifications = new ArrayList();

      Map notification;
      String profileId;
      HashMap profileInfo;
View Full Code Here

  try {
      hsession = HibernateUtils.getSession();
      tx = hsession.beginTransaction();

      Connection conn = hsession.connection();
      Timestamp ts = new Timestamp(pastLimit.getTime());

      System.out.println("#ts=" + ts);

      stmt = conn.
View Full Code Here

    assertEquals( s.createQuery("from Person p where p.class = User").list().size(), 1 );
    assertTrue(s.createQuery("from User u").list().size()==1);
    s.clear();

    // Remove the optional row from the join table and requery the User obj
    s.connection().prepareStatement("delete from t_user").execute();
    s.clear();

    jesus = (User) s.get( Person.class, new Long( jesus.getId() ) );
    s.clear();
View Full Code Here

   
    SQLExceptionConverter converter = getDialect().buildSQLExceptionConverter();

    Session session = openSession();
    session.beginTransaction();
    Connection connection = session.connection();

    // Attempt to insert some bad values into the T_MEMBERSHIP table that should
    // result in a constraint violation
    PreparedStatement ps = null;
    try {
View Full Code Here

  public void testBadGrammar() throws Exception {
    SQLExceptionConverter converter = getDialect().buildSQLExceptionConverter();

    Session session = openSession();
    Connection connection = session.connection();

        // prepare/execute a query against a non-existent table
    PreparedStatement ps = null;
    try {
      ps = connection.prepareStatement("SELECT user_id, user_name FROM tbl_no_there");
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.