Commit Graph

1732 Commits

Author SHA1 Message Date
Mark Paluch
3b6c2f06ae Disable package cycle tests to unblock CI builds.
See #1366
2022-10-31 14:45:38 +01:00
Mark Paluch
3fa10f1482 Update CI properties.
See #1366
2022-10-31 10:36:36 +01:00
Mark Paluch
04aacd89d2 After release cleanups.
See #1333
2022-10-13 17:31:17 +02:00
Mark Paluch
61dcc5168b Prepare next development iteration.
See #1333
2022-10-13 17:31:15 +02:00
Mark Paluch
99ac540555 Release version 3.0 RC1 (2022.0.0).
See #1333
2022-10-13 17:24:26 +02:00
Mark Paluch
debf0b7563 Prepare 3.0 RC1 (2022.0.0).
See #1333
2022-10-13 17:24:05 +02:00
Jens Schauder
154e18cb01 Polishing.
Removes code duplication.

Original pull request #1348
2022-10-11 13:02:45 +02:00
Koen Punt
d604797e42 Support SimpleFunction and SimpleExpression in order by expression.
This allows ordering by functions like:

    ORDER BY GREATEST(table1.created_at, table2.created_at) ASC

or by arbitrary SQL snippets

    orderBy(OrderByField.from(Expressions.just("1")).asc()) => ORDER BY 1 ASC

Original pull request #1348
2022-10-11 13:02:45 +02:00
Jens Schauder
58bf5566b6 Dependency tests are now based on ArchUnit.
Replaced ignored tests with exclusion of packages and classes.
Upgraded ArchUnit dependency to 1.0.0.

Closes #1354
2022-10-10 13:27:59 +02:00
Jens Schauder
6bdc7db24b Offer a proper replacement for NamingStrategy.INSTANCE.
Closes #1350
2022-10-07 16:24:47 +02:00
Mark Paluch
795e244511 Polishing.
Do not expose setForeignKeyNaming methods on NamingStrategy to make less assumptions about how a naming strategy gets implemented. Provide getRequiredLeafEntity method on PersistentPropertyPathExtension to reduce null and state assertion checks.

Refine getTableName/getQualifiedTableName approach to reduce API surface and avoid deprecations.

See #1147
Original pull request: #1324.
2022-10-07 09:17:27 +02:00
Jens Schauder
e7d32bbea2 Polishing.
See #1162
Original pull request: #1324.
2022-10-07 09:17:21 +02:00
Jens Schauder
d7f2a27ee9 Revised default behaviour for back reference naming.
The new default is to take `@Table` annotations into account.

The behaviour can be configured by setting the `foreignKeyNaming` property on the `RelationalMappingContext`.

Closes #1162
See #1147
Original pull request: #1324.
2022-10-07 09:17:15 +02:00
Jens Schauder
40446f9ca9 The back reference generation is now configurable.
The default version is the behavior that existed so far:
The back reference is the table name as generated by the `NamingStrategy` without taking `@Table` annotations into account.

The new alternative is to take `@Table` into account.

The behavior can be configured by setting the `foreignKeyNaming` property on the `RelationalMappingContext`.

Closes #1161
Closes #1147
Original pull request: #1324.
2022-10-07 09:17:05 +02:00
Jens Schauder
15796b88fe Fix broken includes in reference documentation.
Closes #1349
2022-10-06 14:53:40 +02:00
Jens Schauder
004804aad8 Introduce @InsertOnlyProperty.
You may now annotate properties of the aggregate root with `@InsertOnlyProperty`.
Properties annotated in such way will be written to the database only during insert operations, but they will not be updated afterwards.

Closes #637
Original pull request #1327
2022-10-06 12:54:33 +02:00
Mark Paluch
76ea47ab16 Deprecate mutability of DelegatingDataAccessStrategy.
See: #1315
Original pull request: #1324.
2022-10-05 15:34:11 +02:00
Mark Paluch
26c5c5dd93 Polishing.
Use consistent method and argument names for newly introduced methods. Reorder and group template API methods to keep related methods together.

See: #1315
Original pull request: #1324.
2022-10-05 15:34:11 +02:00
Jens Schauder
aef1e34f5e Drop superfluous class argument from delete methods in JdbcAggregateTemplate.
Closes: #1315
Original pull request: #1324.
2022-10-05 15:34:11 +02:00
Jens Schauder
01e98dc171 Polishing.
See: #1315
Original pull request: #1324.
2022-10-05 15:34:11 +02:00
Jens Schauder
e171d4b91b Remove non-Javadoc comments.
These are no longer serve their purpose.

Closes #1347
2022-10-05 15:34:11 +02:00
Jens Schauder
ea00369f07 Add support for factory methods.
R2DBC now supports the use of factory methods for entity creation.
Spring Data JDBC already does so via f326897950

Simply annotate a static factory method on your entity class with `@PersistenceCreator`.

Closes #1346
See https://github.com/spring-projects/spring-data-commons/issues/2476
See f326897950
2022-10-05 15:34:10 +02:00
Jens Schauder
d1890e3b69 Reuse existing infrastructure for SpEL processing.
Original pull request #229
See #619
2022-09-30 12:29:12 +02:00
Christopher Klein
9abaa5a911 Support for SpEL inside @Query annotations.
Constructs like the following work now.

```
@Query("select u from User u where u.firstname = :#{#customer.firstname}")
List<User> findUsersByCustomersFirstname(@Param("customer") Customer customer);
```

Closes #619
Original pull request #229
See https://spring.io/blog/2014/07/15/spel-support-in-spring-data-jpa-query-definitions
2022-09-30 12:27:46 +02:00
Jens Schauder
f326897950 Removed deprecations.
Removed deprecated API and usasage of deprecated API.

Closes #1340
2022-09-28 12:02:46 +02:00
Jens Schauder
98ef3df478 Polishing.
Original pull request #1338
See #1329
2022-09-26 14:22:06 +02:00
Hari Ohm Prasth Rajagopal
9b6570452c Avoid exception for empty criteria.
Code changes to check for both null and empty criteria before proceeding to where clause generation avoids exception.

Closes #1329
Original pull request #1338
2022-09-26 14:22:06 +02:00
Spring Builds
fb5895b80b After release cleanups.
See #1295
2022-09-19 14:39:12 +00:00
Spring Builds
3ab0731fe4 Prepare next development iteration.
See #1295
2022-09-19 14:39:01 +00:00
Spring Builds
22618431d8 Release version 3.0 M6 (2022.0.0).
See #1295
2022-09-19 14:15:28 +00:00
Spring Builds
2c28684347 Prepare 3.0 M6 (2022.0.0).
See #1295
2022-09-19 14:13:05 +00:00
Jens Schauder
09dfbf14a3 Clarify that events and callbacks documentation.
Events and callbacks only get triggered for aggregate roots.

Closes #1328
2022-09-14 13:55:30 +02:00
Mark Paluch
3f1dab93e4 Adopt to changed Mockk artifact name.
Closes #1326
2022-09-12 11:16:58 +02:00
Jens Schauder
bf356f561d Clarify documentation for @Modifying.
Modifying queries are executed directly against the database.
No events or callbacks get called.
Therefore also fields with auditing annotations do not get updated if they don't get updated in the annotated query.

Closes #970
2022-09-08 15:31:17 +02:00
Jens Schauder
7a4143fb50 Changelog removed.
Closes #1013
2022-09-08 15:22:46 +02:00
Jens Schauder
0609df0ae7 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-08-31 15:48:54 +02:00
Jens Schauder
7b1f680a26 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:30:24 +02:00
Joshua Sattler
f5989e1cfc Simplify code in mapping example.
Original pull request #1319
2022-08-29 09:07:48 +02:00
Jens Schauder
dad6e056e8 Avoid noop update for Id only aggregates.
Closes #1309
2022-08-25 14:19:04 +02:00
Mark Paluch
b46e34263e Fix COUNT/EXISTS projections for entities without an identifier.
We now issue a COUNT(1) respective SELECT 1 for COUNT queries and EXISTS queries for entities that do not specify an identifier.

Previously these query projections could fail because of empty select lists.

Closes #1310
2022-08-18 12:06:03 +02:00
Mark Paluch
92e77a47c9 Retain element ordering in AfterConvertCallbacks.
We now use concatMap on result Fluxes to retain the object order. Previously, we used flatMap on a flux that has led to changes in element ordering.

Closes #1307
2022-08-16 11:21:07 +02:00
Mark Paluch
e246cc4f59 Fix parameter binding of reused named parameters using anonymous bind markers.
We now properly bind values for reused named parameters correctly when using anonymous bind markers (e.g. ? for MySQL). Previously, the subsequent usages of named parameters especially with IN parameters were left not bound.

Closes #1306
2022-08-16 11:06:30 +02:00
Jens Schauder
2a8f62245b Remove deprecated code.
This removes most currently deprecated code.

An exception are various deprecations in Spring Data R2DBC for which it is not obvious how to modify the code that is still using the deprecated API.

Original pull request #1304
2022-08-11 10:44:51 +02:00
Jens Schauder
07ade67862 Polishing.
Code formatting.

See #1073
Original pull request #1074
2022-08-10 14:03:14 +02:00
Jens Schauder
fd662bf9e6 Avoid duplicate selection of columns.
When the key column of a MappedCollection is also present in the contained entity that column got select twice.
We now check if the column already gets selected before adding it to the selection.

This only works properly if the column names derived for the entity property and the key column match exactly, which might require use of a `@Column` annotation depending on the used NamingStrategy.

Closes #1073
Original pull request #1074
2022-08-10 14:02:51 +02:00
Mark Paluch
0d1ba211c5 Polishing.
Reuse H2 dialect settings in R2DBC-specific H2 dialect.
Refactor ArrayColumns support classes, into toplevel-types. Let R2DBC H2 sublass the relational H2Dialect to decouple from Postgres.

See #1287
Original pull request #1297
2022-08-10 13:01:02 +02:00
Mark Paluch
c2e163b5c2 Use OFFSET/FETCH syntax in H2 dialect.
As per suggestion of the H2 maintainer.

Closes #1287
Original pull request #1297
2022-08-10 13:01:01 +02:00
Jens Schauder
1fd38cb945 Upgrade MariaDb JDBC driver to 3.0.7
Closes #1281
2022-08-08 15:25:34 +02:00
dependabot[bot]
d4fe31a9e8 Upgrade to postgresql 42.4.1.
Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.4.0 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.4.0...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Closes #1302
2022-08-08 09:43:45 +02:00
Jens Schauder
fcbecda414 Remove the namespace reference and links to it.
Closes #1290
See https://github.com/spring-projects/spring-data-commons/issues/2662
Original pull request #1298
2022-07-26 10:16:02 +02:00