Java Code Examples for org.springframework.jdbc.core.JdbcOperations#execute()

The following examples show how to use org.springframework.jdbc.core.JdbcOperations#execute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdbcTemplateCrudDSL.java    From SimpleFlatMapper with MIT License 5 votes vote down vote up
public JdbcTemplateCrud<T, K> to(JdbcOperations jdbcOperations, final String table) {
    final JdbcMapperFactory factory = JdbcMapperFactory.newInstance(jdbcTemplateMapperFactory);

    Crud<T, K> crud =
        jdbcOperations.execute(new ConnectionCallback<Crud<T, K>>() {
            @Override
            public Crud<T, K> doInConnection(Connection connection) throws SQLException, DataAccessException {
                return factory.<T, K>crud(target, keyTarget).table(connection, table);
            }
        });

    return new JdbcTemplateCrud<T, K>(jdbcOperations, crud);
}
 
Example 2
Source File: JdbcTemplateCrudDSL.java    From SimpleFlatMapper with MIT License 5 votes vote down vote up
public JdbcTemplateCrud<T, K> to(JdbcOperations jdbcOperations) {
    final JdbcMapperFactory factory = JdbcMapperFactory.newInstance(jdbcTemplateMapperFactory);

    Crud<T, K> crud =
            jdbcOperations.execute(new ConnectionCallback<Crud<T, K>>() {
                @Override
                public Crud<T, K> doInConnection(Connection connection) throws SQLException, DataAccessException {
                    return factory.<T, K>crud(target, keyTarget).to(connection);
                }
            });

    return new JdbcTemplateCrud<T, K>(jdbcOperations, crud);
}