File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
spring-jdbc/src/main/java/org/springframework/jdbc/core/simple Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,25 @@ public DefaultJdbcClient(NamedParameterJdbcOperations jdbcTemplate) {
83
83
this .namedParamOps = jdbcTemplate ;
84
84
}
85
85
86
+ /**
87
+ * Expose the classic Spring JdbcTemplate to allow invocation of
88
+ * classic JDBC operations.
89
+ */
90
+ @ Override
91
+ public JdbcOperations getJdbcOperations () {
92
+ return this .classicOps ;
93
+ }
94
+
95
+ /**
96
+ * Expose the classic Spring {@link JdbcTemplate} itself, if available,
97
+ * in particular for passing it on to other {@code JdbcTemplate} consumers.
98
+ * <p>If sufficient for the purposes at hand, {@link #getJdbcOperations()}
99
+ * is recommended over this variant.
100
+ */
101
+ public JdbcTemplate getJdbcTemplate () {
102
+ Assert .state (this .classicOps instanceof JdbcTemplate , "No JdbcTemplate available" );
103
+ return (JdbcTemplate ) this .classicOps ;
104
+ }
86
105
87
106
@ Override
88
107
public StatementSpec sql (String sql ) {
Original file line number Diff line number Diff line change 28
28
29
29
import org .springframework .dao .support .DataAccessUtils ;
30
30
import org .springframework .jdbc .core .JdbcOperations ;
31
+ import org .springframework .jdbc .core .JdbcTemplate ;
31
32
import org .springframework .jdbc .core .ResultSetExtractor ;
32
33
import org .springframework .jdbc .core .RowCallbackHandler ;
33
34
import org .springframework .jdbc .core .RowMapper ;
@@ -76,6 +77,19 @@ public interface JdbcClient {
76
77
*/
77
78
StatementSpec sql (String sql );
78
79
80
+ /**
81
+ * Expose the classic Spring JdbcTemplate to allow invocation of
82
+ * classic JDBC operations.
83
+ */
84
+ JdbcOperations getJdbcOperations ();
85
+
86
+ /**
87
+ * Expose the classic Spring {@link JdbcTemplate} itself, if available,
88
+ * in particular for passing it on to other {@code JdbcTemplate} consumers.
89
+ * <p>If sufficient for the purposes at hand, {@link #getJdbcOperations()}
90
+ * is recommended over this variant.
91
+ */
92
+ JdbcTemplate getJdbcTemplate ();
79
93
80
94
// Static factory methods
81
95
You can’t perform that action at this time.
0 commit comments