Package org.springframework.jdbc.support

Examples of org.springframework.jdbc.support.SQLStateSQLExceptionTranslator


  public static SQLExceptionTranslator newJdbcExceptionTranslator(SessionFactory sessionFactory) {
    DataSource ds = getDataSource(sessionFactory);
    if (ds != null) {
      return new SQLErrorCodeSQLExceptionTranslator(ds);
    }
    return new SQLStateSQLExceptionTranslator();
  }
View Full Code Here


  public static SQLExceptionTranslator newJdbcExceptionTranslator(SessionFactory sessionFactory) {
    DataSource ds = getDataSource(sessionFactory);
    if (ds != null) {
      return new SQLErrorCodeSQLExceptionTranslator(ds);
    }
    return new SQLStateSQLExceptionTranslator();
  }
View Full Code Here

    // Check for PersistenceManagerFactory's DataSource.
    if (connectionFactory instanceof DataSource) {
      return new SQLErrorCodeSQLExceptionTranslator((DataSource) connectionFactory);
    }
    else {
      return new SQLStateSQLExceptionTranslator();
    }
  }
View Full Code Here

  public static SQLExceptionTranslator newJdbcExceptionTranslator(SessionFactory sessionFactory) {
    DataSource ds = getDataSource(sessionFactory);
    if (ds != null) {
      return new SQLErrorCodeSQLExceptionTranslator(ds);
    }
    return new SQLStateSQLExceptionTranslator();
  }
View Full Code Here

    rsControl.setVoidCallable(1);
    rsControl.replay();

    jdbcTemplate = new JdbcTemplate();
    jdbcTemplate.setDataSource(new SingleConnectionDataSource(con, false));
    jdbcTemplate.setExceptionTranslator(new SQLStateSQLExceptionTranslator());
    jdbcTemplate.afterPropertiesSet();
  }
View Full Code Here

    }
    TestJdbcTemplate t = new TestJdbcTemplate();
    t.setDataSource(localDs);
    // Will fail without the following, because we're not able to get a connection from the
    // DataSource here if we need to to create an ExceptionTranslator
    t.setExceptionTranslator(new SQLStateSQLExceptionTranslator());
    StoredProcedureConfiguredViaJdbcTemplate sp = new StoredProcedureConfiguredViaJdbcTemplate(t);
   
    assertEquals(sp.execute(11), 5);
    assertEquals(1, t.calls);
   
View Full Code Here

    };
    lsfb.afterPropertiesSet();
    final SessionFactory sfProxy = (SessionFactory) lsfb.getObject();

    HibernateTransactionManager tm = new HibernateTransactionManager();
    tm.setJdbcExceptionTranslator(new SQLStateSQLExceptionTranslator());
    tm.setSessionFactory(sfProxy);
    tm.setDataSource(ds);
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
    tt.setTimeout(10);
View Full Code Here

    };
    lsfb.afterPropertiesSet();
    final SessionFactory sfProxy = (SessionFactory) lsfb.getObject();

    HibernateTransactionManager tm = new HibernateTransactionManager();
    tm.setJdbcExceptionTranslator(new SQLStateSQLExceptionTranslator());
    tm.setSessionFactory(sfProxy);
    tm.setDataSource(ds);
    tm.setEarlyFlushBeforeCommit(true);
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
View Full Code Here

    sessionControl.replay();
    txControl.replay();
    queryControl.replay();

    HibernateTransactionManager tm = new HibernateTransactionManager();
    tm.setJdbcExceptionTranslator(new SQLStateSQLExceptionTranslator());
    tm.setNestedTransactionAllowed(true);
    tm.setSessionFactory(sf);
    tm.setDataSource(ds);
    final TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_NESTED);
View Full Code Here

    conControl.replay();
    stmtControl.replay();

    jdbcTemplate = new JdbcTemplate();
    jdbcTemplate.setDataSource(new SingleConnectionDataSource(con, false));
    jdbcTemplate.setExceptionTranslator(new SQLStateSQLExceptionTranslator());
    jdbcTemplate.afterPropertiesSet();
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.support.SQLStateSQLExceptionTranslator

Copyright © 2018 www.massapicom. 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.