Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.ConnectionCallback


  public OracleTypeHandler(DatabaseMetaData databaseMetaData) throws SQLException {
    super(databaseMetaData);
  }

  public Object transformInputValue(JdbcTemplate jdbcTemplate, SqlParameter sqlParameter, Object value){
    ConnectionCallback connectionCallback;

    switch (sqlParameter.getSqlType()){
      case Types.STRUCT:
      case Types.ARRAY:
        connectionCallback = new TransformInputConnectionCallback(sqlParameter, value);
View Full Code Here


    return value;
  }

  public Object transformOutputValue(JdbcTemplate jdbcTemplate, SqlParameter sqlParameter, Object value, Class<?> type) {
    ConnectionCallback connectionCallback;

    switch (sqlParameter.getSqlType()){
      case Types.STRUCT:
      case Types.ARRAY:
      case OracleTypes.CURSOR:
View Full Code Here

            getGeneratedKeyNames().length  + " columns specified: " + Arrays.asList(getGeneratedKeyNames()));
      }
      // This is a hack to be able to get the generated key from a database that doesn't support
      // get generated keys feature.  HSQL is one, PostgreSQL is another.  Has to be done with the same
      // connection.
      jdbcTemplate.execute(new ConnectionCallback() {
        public Object doInConnection(Connection con) throws SQLException, DataAccessException {
          // Do the insert
          PreparedStatement ps = null;
          try {
            ps = con.prepareStatement(getInsertString());
View Full Code Here

        HashMap keys = new HashMap(1);
        keys.put(getGeneratedKeyNames()[0], key);
        keyHolder.getKeyList().add(keys);
      }
      else {
        jdbcTemplate.execute(new ConnectionCallback() {
          public Object doInConnection(Connection con) throws SQLException, DataAccessException {
            // Do the insert
            PreparedStatement ps = null;
            try {
              ps = con.prepareStatement(getInsertString());
View Full Code Here

        HashMap keys = new HashMap(1);
        keys.put(getGeneratedKeyNames()[0], key);
        keyHolder.getKeyList().add(keys);
      }
      else {
        jdbcTemplate.execute(new ConnectionCallback() {
          public Object doInConnection(Connection con) throws SQLException, DataAccessException {
            // Do the insert
            PreparedStatement ps = null;
            try {
              ps = con.prepareStatement(getInsertString());
View Full Code Here

        this.transactionTemplate = new TransactionTemplate();
        transactionTemplate.setTransactionManager(new DataSourceTransactionManager(jdbcTemplate.getDataSource()));
        transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);

        // 初始化一些数据
        jdbcTemplate.execute(new ConnectionCallback() {

            public Object doInConnection(Connection c) throws SQLException, DataAccessException {
                DatabaseMetaData meta = c.getMetaData();
                databaseName = meta.getDatabaseProductName();
                databaseMajorVersion = meta.getDatabaseMajorVersion();
View Full Code Here

        return findTable(jdbcTemplate, catalogName, schemaName, tableName, null);
    }

    public static Table findTable(final JdbcTemplate jdbcTemplate, final String catalogName, final String schemaName,
                                  final String tableName, final DdlUtilsFilter filter) throws Exception {
        return (Table) jdbcTemplate.execute(new ConnectionCallback() {

            public Object doInConnection(Connection con) throws SQLException, DataAccessException {
                Table table = null;
                DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper();
View Full Code Here

    @SuppressWarnings("unchecked")
    public static List<Table> findTables(final JdbcTemplate jdbcTemplate, final String catalogName,
                                         final String schemaName, final String tableNamePattern,
                                         final DdlUtilsFilter filter, final DdlTableNameFilter tableNameFilter)
                                                                                                               throws Exception {
        return (List<Table>) jdbcTemplate.execute(new ConnectionCallback() {

            public Object doInConnection(Connection con) throws SQLException, DataAccessException {
                List<Table> tables = new ArrayList<Table>();
                DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper();
View Full Code Here

        this.transactionTemplate = new TransactionTemplate();
        transactionTemplate.setTransactionManager(new DataSourceTransactionManager(jdbcTemplate.getDataSource()));
        transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);

        // 初始化一些数据
        jdbcTemplate.execute(new ConnectionCallback() {

            public Object doInConnection(Connection c) throws SQLException, DataAccessException {
                DatabaseMetaData meta = c.getMetaData();
                databaseName = meta.getDatabaseProductName();
                databaseMajorVersion = meta.getDatabaseMajorVersion();
View Full Code Here

        HashMap keys = new HashMap(1);
        keys.put(getGeneratedKeyNames()[0], key);
        keyHolder.getKeyList().add(keys);
      }
      else {
        jdbcTemplate.execute(new ConnectionCallback() {
          public Object doInConnection(Connection con) throws SQLException, DataAccessException {
            // Do the insert
            PreparedStatement ps = null;
            try {
              ps = con.prepareStatement(getInsertString());
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.ConnectionCallback

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.