Commit Graph

880 Commits

Author SHA1 Message Date
Sam Brannen 734d113b11 Ensure configuration methods in SimpleJdbcInsert support method chaining
Prior to this commit, the withoutTableColumnMetaDataAccess() and
includeSynonymsForTableColumnMetaData() methods in SimpleJdbcInsert
incorrectly declared a SimpleJdbcInsertOperations return type, which
prevented method chaining when the instance was declared to be of type
SimpleJdbcInsert.

This commit changes the return types of those methods to
SimpleJdbcInsert to benefit from covariant return types like the rest
of the configuration methods in SimpleJdbcInsert.

Closes gh-31177
2023-09-06 11:37:50 +02:00
Sam Brannen 0a7166234d Polishing 2023-09-06 11:37:50 +02:00
Sam Brannen 552e7fb1d5 Test another scenario 2023-09-06 11:10:44 +02:00
Sam Brannen 7dc0653f38 Revise quoted identifier support in SimpleJdbcInsert
Prior to this commit and the previous commit, SimpleJdbcInsert did not
provide built-in support for "quoted identifiers". Consequently, if any
column names conflicted with keywords or functions from the underlying
database, you had to manually quote the column names when specifying
them via `usingColumns(...)`, and there was unfortunately no way to
quote schema and table names.

The previous commit provided rudimentary support for quoted SQL
identifiers (schema, table, and column names) by querying
java.sql.DatabaseMetaData.getIdentifierQuoteString() to determine the
quote string. It also introduced `usingEscaping(boolean)` in
`SimpleJdbcInsertOperations` to enable the feature. However, it
incorrectly quoted the schema and table names together, and it did not
take into account the fact that a quoted identifier should respect the
casing (uppercase vs. lowercase) of the underlying database's metadata.

This commit revises quoted identifier support in `SimpleJdbcInsert` by:

- renaming `usingEscaping(boolean)` to `usingQuotedIdentifiers()`

- quoting schema and table names separately

- respecting the casing (uppercase vs. lowercase) of the underlying
  database's metadata when quoting identifiers

- introducing integration tests against an in-memory H2 database

See gh-13874
Closes gh-24013
2023-09-05 13:29:40 +02:00
Kita, Maksim d39034754f Support quoted identifiers in SimpleJdbcInsert
See gh-24013
2023-09-05 13:29:40 +02:00
Sam Brannen 070590cb11 Introduce TableMetaDataProvider.columnNameToUse(String) 2023-09-05 13:29:40 +02:00
Sam Brannen 4c45f37166 Polish simple JDBC support classes 2023-09-05 11:36:48 +02:00
Juergen Hoeller 855fe39b7f Use PreparedStatementCreator for query/update with indexed params
Closes gh-31122
2023-09-03 00:44:11 +02:00
Stephane Nicoll f9cffcce05 Polish "Avoid calling executeBatch() with an empty batch"
See gh-27154
2023-08-26 17:05:39 +02:00
Li0n13 2d7bf83d8d Avoid calling executeBatch() with an empty batch
See gh-27154
2023-08-26 17:05:20 +02:00
Sam Brannen 5f893cadc5 Merge branch '6.0.x' 2023-08-21 16:03:52 +02:00
Sam Brannen 229b4782ee Add @Nullable in doSetValue() in Argument[Type]PreparedStatementSetter
This commit adds @Nullable to the argValue parameters in the
doSetValue() methods in ArgumentPreparedStatementSetter and
ArgumentTypePreparedStatementSetter.

Closes gh-31086
2023-08-21 16:01:42 +02:00
Sam Brannen ad1554a631 Polishing 2023-08-21 16:01:22 +02:00
Toshiaki Maki 8f7d61650d
Add @Nullable to value in param() methods in JdbcClient
Closes gh-31084
2023-08-21 15:50:38 +02:00
Sam Brannen e0fb777325 Introduce var-args params() method in JdbcClient's StatementSpec
Closes gh-31070
2023-08-18 12:00:28 +02:00
Sam Brannen 48e94f535c Polish JdbcClient 2023-08-18 12:00:28 +02:00
Juergen Hoeller d89e305c87 Introduce SimplePropertyRowMapper with flexible constructor/property/field mapping
Includes query(Class) method with value and property mapping support on JdbcClient.
JdbcClient's singleColumn/singleValue are declared without a Class parameter now.

Closes gh-26594
See gh-30931
2023-08-15 13:14:52 +02:00
Juergen Hoeller 45c20e34e4 Merge branch '6.0.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/context/annotation/PropertySourceAnnotationTests.java
2023-08-14 19:29:14 +02:00
Juergen Hoeller 2ce75dc415 Polishing 2023-08-14 19:28:19 +02:00
Juergen Hoeller b4c61f20e7 Mention JdbcClient in package documentation
Closes gh-31017
2023-08-09 23:18:55 +02:00
Juergen Hoeller 3c34e69cc2 Merge branch '6.0.x' 2023-08-07 14:53:01 +02:00
Juergen Hoeller 2aae0a4e0c Polishing 2023-08-07 14:51:58 +02:00
Sam Brannen 96fd3c10fb Update copyright headers 2023-08-07 12:08:04 +03:00
Juergen Hoeller 3253d2de89 Introduce TransactionExecutionListener with begin/commit/rollback notifications
Includes ConfigurableTransactionManager interface for listener registration.
Includes additional introspection methods on TransactionExecution interface.
Includes default method declarations on TransactionStatus/SmartTransactionObject.

Closes gh-27479
2023-08-06 14:03:44 +02:00
Juergen Hoeller d250a5155a Consistent dependency declarations 2023-08-02 00:56:50 +02:00
Juergen Hoeller 3b1af692cc Merge branch '6.0.x'
# Conflicts:
#	spring-beans/spring-beans.gradle
#	spring-context/spring-context.gradle
#	spring-orm/spring-orm.gradle
#	spring-test/spring-test.gradle
#	spring-web/spring-web.gradle
#	spring-webflux/spring-webflux.gradle
2023-08-02 01:04:31 +02:00
Sam Brannen 06c6af9b0d Stop using Constants utility in IsolationLevelDataSourceRouter
See gh-30851
2023-07-31 16:08:47 +03:00
Sam Brannen 181c814e69 Polish IsolationLevelDataSourceRouter 2023-07-31 16:08:47 +03:00
Sam Brannen 0eda44186a Polish tests for configuration constants
See gh-30851
2023-07-31 16:08:47 +03:00
Sam Brannen 48eb477755 Assert LazyConnectionDataSourceProxy.setDefaultTransactionIsolation() values
See gh-30851
2023-07-31 15:11:52 +03:00
Sam Brannen cc9278666d Stop using Constants utility in LazyConnectionDataSourceProxy
See gh-30851
2023-07-31 13:56:49 +03:00
Sam Brannen c87925cee7 Polish LazyConnectionDataSourceProxy 2023-07-31 13:56:49 +03:00
Juergen Hoeller 3437e61f98 Merge branch '6.0.x' 2023-07-26 12:08:20 +02:00
Juergen Hoeller 2573ba4a50 Polishing 2023-07-26 12:07:11 +02:00
Juergen Hoeller bbde68c49e Polishing 2023-07-25 19:12:07 +02:00
Juergen Hoeller ccaccda6ca Polishing 2023-07-25 19:22:02 +02:00
Juergen Hoeller 5ebbb3ff3e Merge branch '6.0.x'
# Conflicts:
#	spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java
#	spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java
#	spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.java
2023-07-25 19:13:33 +02:00
Juergen Hoeller 019c34f480 Introduce JdbcClient as a fluent facade for query/update execution
Delegates to JdbcTemplate/NamedParameterJdbcTemplate underneath the covers.
Supports parameter objects/records through SimplePropertySqlParameterSource.

Closes gh-30931
2023-07-25 18:10:30 +02:00
Sam Brannen 9571aa1c68 Stop using Constants utility in IsolationLevelDataSourceAdapter
See gh-30851
2023-07-19 18:05:41 +03:00
Sam Brannen a34f9fa66c Update copyright headers 2023-07-15 13:10:46 +02:00
Sam Brannen 5ce8ffd197 Merge branch '6.0.x' 2023-07-15 13:11:03 +02:00
Sam Brannen 70cf754a2f Suppress warnings in tests 2023-07-15 13:02:16 +02:00
Sam Brannen e6d360c1c6 Polishing 2023-07-15 12:58:18 +02:00
Juergen Hoeller fd17df91fd Merge branch '6.0.x'
# Conflicts:
#	spring-jdbc/src/main/java/org/springframework/jdbc/support/AbstractFallbackSQLExceptionTranslator.java
2023-07-14 14:38:24 +02:00
Juergen Hoeller 384246c360 Polishing 2023-07-14 14:37:34 +02:00
Juergen Hoeller 519927421e Add support for configurable custom translator
Closes gh-24634
2023-07-14 14:17:20 +02:00
Juergen Hoeller 064cd3b7af Merge branch '6.0.x'
# Conflicts:
#	gradle.properties
#	spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java
2023-07-14 12:18:41 +02:00
Juergen Hoeller 75f5dac16b Polishing 2023-07-14 12:16:37 +02:00
Juergen Hoeller 094eb3e236 Use varargs for array elements
See gh-1850
2023-07-13 00:55:35 +02:00
Juergen Hoeller 3fed2ec3a1 Add common SqlValue implementation for JDBC Array creation
Closes gh-1850
2023-07-13 00:28:32 +02:00