Commit Graph

308 Commits

Author SHA1 Message Date
Mark Paluch
0387a4752d Extend license header copyright years to 2023.
See #1399
2023-01-02 09:51:54 +01:00
Jens Schauder
37b144fb9d Reenable quoting for SqlServerDialect.
Quoting is important since it allows use of keywords as names.
We do not change the letter casing.
In a default setup the database does not care since it is case-insensitive.
If configured to be case-sensitive it makes sense to pass on what ever letter casing there is, since you seem to care.

Closes #1216
See #914
2022-12-07 09:57:34 +01:00
Dmitriy
bfed8c0fcd Add Transactional annotation to deleteAllById.
Original pull request #1370
2022-11-15 16:26:33 +01:00
Jens Schauder
2d76885fc6 Correct behavior of NOOP deletes to match the specification in CrudRepository.
Delete operations that receive a version attribute throw an `OptimisticFailureException` when they delete zero rows.
Otherwise, the NOOP delete gets silently ignored.

Note that save operations that are determined to be an update because the aggregate is not new will still throw an `IncorrectUpdateSemanticsDataAccessException` if they fail to update any row.
This is somewhat asymmetric to the delete-behaviour.
But with a delete the intended result is achieved: the aggregate is gone from the database.
For save operations the intended result is not achieved, hence the exception.

Closes #1313
Original pull request: #1314.
See https://github.com/spring-projects/spring-data-commons/issues/2651
2022-08-31 15:32:27 +02:00
Jens Schauder
d95b5592a7 Avoid noop update for Id only aggregates.
Closes #1309
2022-08-25 14:28:13 +02:00
Jens Schauder
162194bc6c Introduce new constructor for SimpleJdbcRepository.
This is in preparation for #1195.

See #1195
2022-07-13 13:25:00 +02:00
Jens Schauder
90ab2f741c Polishing.
See #1254
2022-06-01 11:42:48 +02:00
Jens Schauder
cac69a8a90 Reestablish previous exception behavior.
When saving an Aggregate which is not new, but has a null version attribute we now throw a DbActionExecutionException, like we used to.

Closes #1254
2022-06-01 11:42:39 +02:00
Jens Schauder
93837a198f Polishing.
Original pull request #1226
See #1212
2022-05-17 15:22:07 +02:00
Chirag Tailor
4fb0ccf721 Update @Query argument conversion to handle Collection<Enum>.
+ Copy logic from QueryMapper#convertToJdbcValue to resolve Iterable
  arguments on findBy* query methods to resolve the same for @Query.
+ Use parameter ResolvableType instead of Class to retain generics info.

Original pull request #1226
Closes #1212
2022-05-17 15:22:07 +02:00
Jens Schauder
716ddc43a8 Deprecate classes supporting H2 1.x.
Support for the 1.x branch of H2 will be dropped with the next major release.

See #1243
2022-05-16 13:59:51 +02:00
Jens Schauder
0e590ad950 Polishing
See #1232
2022-05-11 12:18:21 +02:00
Jens Schauder
60117f1423 This reintroduces the behavior of BeforeSaveCallbacks to allow for creating an Id for an insert operation.
This behavior is strictly speaking not correct, since this kind of action should be performed in a BeforeConversionCallback.

Closes #1232
2022-05-11 12:18:21 +02:00
Jens Schauder
906f75c5f4 Polishing.
Changed default behaviour to an empty name for embedded entities.
This allows to use embedded entities for column tuples without special prefix.

Original pull request #1149
2022-03-23 15:31:03 +01:00
Daniil Razorenov
f21f031a4a Fix assemble table alias for embedded entity with empty prefix and reference.
Table alias for embedded entity use prefix value from Embedded annotation. But default value for prefix is empty string. If try to create SqlIdentifier for empty string it throw exception. To avoid this behavior, if prefix is an empty string, property name for embedded entity is taken instead.
2022-03-23 11:43:35 +01:00
Jens Schauder
7c20658b14 Polishing.
This change extracts entity modifying behaviour into separate methods, so it doesn't appear as an unexpected side effect of the creation of aggregate changes.

Also some formatting.

Original pull request #1196
See #1137
2022-03-22 17:02:36 +01:00
Chirag Tailor
a1a87a44ef Determine and set the value for entity @Version before conversion to DbActions to simplify execution context.
This change incorporates one test from https://github.com/spring-projects/spring-data-relational/pull/1150

Original pull request #1196
Closes #1137
2022-03-22 17:02:36 +01:00
Mark Paluch
2516067553 Disable package cycle tests.
Property Converters introduced a cycle so we're disabling the tests for now as we cannot resolve these from here.

See #1176
2022-03-21 08:51:19 +01:00
Jens Schauder
2c66ce5d3d Polishing.
Formatting.

See #1159
Original pull request # 1191
2022-03-16 14:17:26 +01:00
Chirag Tailor
014bb7189e Batch inserts of referenced entities.
Insert for entities of same type within an aggregate get inserted using JDBC batch operations when possible.

Inserts are supported when no id needs to be generated by the database or if the Dialect supports generation of ids in batch operations.

Closes #1159
Original pull request # 1191
2022-03-16 14:13:52 +01:00
Jens Schauder
b4d3838d65 Polishing.
Run tests only for a single database since it is actually not testing anything database related.

Formatting.

Original pull request #1187
See #1043
2022-03-07 14:59:22 +01:00
Diego Krupitza
36827110ae Introduced queryLookupStrategy to EnableJdbcRepositories.
Added the missing functionality that is found in the documentation of spring-data-jdbc, but was not present in the code as functionality. Users can not choose between various QueryLookupStrategies.

Closes #1043
Original pull request #1187
2022-03-07 14:59:22 +01:00
Mark Paluch
5352fe34cf Associate value with isTrue/isFalse criteria operators.
We now associate a boolean value with both operators as those operators are rendered using equals comparison in the actual SQL text.

Orginal pull request #1188
2022-03-01 15:37:53 +01:00
Jens Schauder
c8eafe7337 Move Lock to relational module.
This allows both Spring Data R2DBC and Spring Data JDBC to use the same annotation.

See spring-projects/spring-data-jdbc/issues/1041, spring-projects/spring-data-r2dbc/pull/720, spring-projects/spring-data-jdbc/pull/1158
2022-02-22 16:24:32 +01:00
Jens Schauder
63f2331727 Avoid conversion when return value is null.
Closes #1167
2022-02-21 15:11:16 +01:00
Oliver Drotbohm
d4c223d9d5 Adapt to changes in entity creation metadata APIs in Spring Data Commons. 2022-02-15 15:12:58 +01:00
Jens Schauder
e84a34a507 Fixes NPE in PersistentPropertyPathExtension.equals.
Closes #1164
2022-02-11 12:00:18 +01:00
Jens Schauder
e8c933dc80 Polishing.
Adding references to issues on test annotations.
Made test methods package private.

See #1164
2022-02-11 12:00:18 +01:00
Jens Schauder
cd3d0b19b0 Polishing.
Refactored the unit tests to include a negative case and to separate the different scenarios tested.

Removed the default LockMode from the Lock annotation.
I have the feeling that most users will assume an exclusive Lock when none is specified, but also don't want to request stronger locks than required.

Original pull request #1158
See #1041
2022-02-09 16:23:08 +01:00
Diego Krupitza
e68c3557c0 Introduced pessimistic locks for derived queries.
Methods which use the derive query functionality now can be annotated with `@Lock` to used a given `LockMode`. Right now there are two different modes `PESSIMISTIC_READ` and `PESSIMISTIC_WRITE`. Based on the dialect the right select is generated. For example for HSQLDB `Select ... FOR UPDATE`.

See #1041
Original pull request #1158
2022-02-09 16:22:27 +01:00
Jens Schauder
49898726a4 Polishing.
Rename "null handling" to "null precedence".
This is somewhat inconsistent with commons null handling, but more descriptive.

Minor formatting.

Original pull request #1156
See #821
2022-02-08 12:07:38 +01:00
Chirag Tailor
f48bbabc28 Null precedence is now supported if the underlying database supports it.
Original pull request #1156
Closes #821
2022-02-08 12:02:50 +01:00
Jens Schauder
97331f72e3 Replaces java.sql.Types constants with java.sql.SQLType values.
java.sql.Types constants are int values and therefore make it tedious to read and debug the code.
SQLType values are mostly enum constants which are much nicer to use.

Original pull request #1142
2022-02-04 13:26:54 +01:00
Jens Schauder
cef041f683 Polishing.
See #1046
Original pull request #1144
2022-01-31 15:58:09 +01:00
Jens Schauder
45e15b1593 Replaces broken test with a working one.
See #1046, #498
Original pull request #1144
2022-01-31 15:42:57 +01:00
Chirag Tailor
c4933c0be9 Support element conversion of array results.
This is achieved by passing the full availabe type information of the conversion target to the conversion service.

This broke a test which wasn't functional in the first place which becomes obvious when adding the proper assertion.

Closes #1046
Original pull request #1144
2022-01-31 15:39:06 +01:00
Jens Schauder
794b031507 Prepared move of JdbcValue to mapping.
This is to avoid dependency cycles between mapping and conversion.

Closes #1128
2022-01-14 08:45:05 +01:00
Jens Schauder
09f78c4786 Add JdbcValue as a simple type.
Closes #1122
2022-01-12 11:45:36 +01:00
Jens Schauder
1acb66645d Fix missing class issue with H2 version 2.0.202
With older versions H2 returned a proprietary  instance of `TimestampWithTimeZone` from `ResultSet.getObject()`.
We used to support the conversion of that to an `OffsetDateTime`.

With the most recent versions `TimestampWithTimeZone` is no longer part of the H2 driver, and we only register the converter when we encounter older versions of H2.

Closes #1114
See https://github.com/h2database/h2database/pull/1359
2021-12-17 09:15:55 +01:00
Jens Schauder
ee1f420d81 Polishing.
Original pull request #1097
2021-12-07 15:22:57 +01:00
Charles
af72307d4b Fix Flaky Tests.
Original pull request #1097
2021-12-07 15:02:27 +01:00
Jens Schauder
cdff3850ae Migrate off Slf4J to JCL.
Closes #1091
Original pull request #1092
2021-12-07 10:58:11 +01:00
Jens Schauder
2fc35f4ced Postgres geometric types are considered simple.
Closes #1065
Original pull request #1085
2021-12-07 10:42:50 +01:00
Jens Schauder
61c6438bc3 Polishing.
Simplified the code structure.
Ensured backward compatibility by recreating some methods often immediately deprecating them.

Moved new classes to the places where they belong, so that the package ...core.sql.render depends on ...core.dialect and not the other way round.
This causes dependency cycles because dependencies in the other direction already exists.
This will be properly fixed by #1105.
For now the offending classes are ignored by the DependencyTests.

See #777
See #1105

Polishing
2021-12-01 13:39:54 +01:00
Mikhail-Polivakha
7551cbd763 Support inserts for id only entities.
This broke in the past for some databases that do not support empty value lists.

Closes #777
Original pull request #1047
2021-11-29 15:24:24 +01:00
Mark Paluch
239f8c75bd Polishing.
Use column aliases in order-by/expressions when column is aliased. Reduce method visibility in tests.

Closes #968
Original pull request: #1080.
2021-11-08 10:22:07 +01:00
Jens Schauder
7d1ed85cbe Use fully qualified names in ORDER BY clause.
Closes #968
Original pull request: #1080.
2021-11-08 10:22:03 +01:00
Jens Schauder
baee76a46d Make Oracle tests work with Testcontainers 1.16.2.
The new Testcontainers version comes with a standard Oracle image configured and doesn't work with the one we used so far.
Making the standard image work required some tweaks to the setup so that the test user has the required privileges.

Closes #1081
2021-11-05 09:20:16 +01:00
Mark Paluch
4be6bc21ad Polishing.
Reduce test element visibility according to JUnit 5 requirements.

See #1061
2021-10-06 09:07:17 +02:00
Mark Paluch
09596ce1eb Log a warning when a query method is annotated with a query and a query name.
We now log when a query method has an ambiguous declaration to clarify that the declared query is used.

Closes #1061.
2021-10-06 09:07:16 +02:00