Commit Graph

298 Commits

Author SHA1 Message Date
Mark Paluch
bd1c670d55 Add support for fluent limit(int) and scroll(OffsetScrollPosition) to Query by Example queries.
Closes #1609
2023-09-14 08:40:56 +02:00
Jens Schauder
4cf07be37c Polishing.
Original pull request #1604
See #1586
2023-09-08 16:08:07 +02:00
Jens Schauder
f60044225f Remove external column name prefixing for embedded entities.
Original pull request #1604
See #1586
2023-09-08 16:08:06 +02:00
Mark Paluch
d6d99571b1 Introduce MappingRelationalConverter.
Add sophisticated converter to read aggregates from a RowDocument including support for maps, collections, subdocuments, and embeddables considering registered converters.
Use ResultSetRowDocumentExtractor to extract result multi-sets into RowDocument and then later apply object mapping.

Original pull request #1604
Closes #1586
2023-09-08 16:04:12 +02:00
Mark Paluch
879984d2b6 Polishing.
Push JDBC-specific simple types into JdbcPostgresDialect instead of having these in the top-level dialect that shouldn't be tied to any driver technology.

Introduce profile to run Postgres tests only.
2023-09-06 14:54:09 +02:00
Mark Paluch
8e6f33e071 Add support for Postgres UUID arrays using JDBC.
We now use Postgres' JDBC drivers TypeInfoCache to register and determine array types including support for UUID.

Closes #1567
2023-09-06 14:53:45 +02:00
Mark Paluch
518e49d81d Introduce RowDocumentExtractor.
Transform the tabular structure into a graph of RowDocument associated with nested documents and lists.

Add container license acceptance for updated container images.

See #1446
See #1450
See #1445
Original pull request: #1572
2023-08-15 10:16:41 +02:00
Mark Paluch
d9b548815c Polishing.
Extract Single Query Loading branching to SingleQueryFallbackDataAccessStrategy. Inline AggregateReaderFactory into SingleQueryDataAccessStrategy. Move CachingSqlGenerator to AggregateReader as caching root.

Introduce DataAccessStrategyFactory to encapsulate configuration.

Fix Javadoc tag ordering. Remove superfluous MappingContext parameters when Converter is available. Simplify code. Reformat code.

Reorder Functions methods. Tweak Javadoc, move composite function into SingleQuerySqlGenerator.

See #1446
See #1450
See #1445
Original pull request: #1572
2023-08-15 10:16:41 +02:00
Jens Schauder
93821f5f42 Enable Single Query Loading for simple aggregates.
Single Query Loading loads as the name suggests complete aggregates using a single select.
While the ultimate goal is to support this for all aggregates, this commit enables it only for simple aggregate and also only for some operations.
A simple aggregate is an aggregate that only reference up to one other entity and does not have embedded entities.
The supported operations are those available via `CrudRepository`: `findAll`, `findById`, and `findAllByIds`.

Single Query Loading does NOT work with the supported in memory databases H2 and HSQLDB, since these do not properly support windowing functions, which are essential for Single Query Loading.

To turn on Single Query Loading call `RelationalMappingContext.setSingleQueryLoadingEnabled(true)`.

Closes #1446
See #1450
See #1445
Original pull request: #1572
2023-08-15 10:16:41 +02:00
Christoph Strobl
e9e21c5918 Update broken links in Javadoc.
Closes: #1578
2023-08-03 09:28:39 +02:00
Jens Schauder
d00e928db5 Introduce AggregatePath.
AggregatePath replaces PersistentPropertyPathExtension.
It gets created and cached by the RelationalMappingContext, which should be more efficient and certainly looks nicer.

Closes #1525
Original pull request #1486
2023-07-21 17:39:17 +02:00
Mark Paluch
9b2032d153 Replace JdbcRepositoryFactoryBean autowiring with RuntimeBeanReferences.
We now specify runtime bean references to qualify the desired mapping context type instead of using autowiring that can match the wrong mapping context.

Closes #1143
2023-06-08 15:40:41 +02:00
Mark Paluch
b2950bf133 Polishing.
Reformat code, switch to tabs. Accept property in DatabaseTypeMapping to provide more context to the type mapping component.

Rename LiquibaseChangeSetGenerator to …Writer as we're writing a changeset and computing the contents is a consequence of writing a changeset. Refine naming to express what we're actually doing.

Introduce setters for enhanced configuration of predicates. Reduce visibility of types to avoid unwanted public API where public access is not needed.

Remove usused code, move methods around for improved grouping of code.

Rename package to schema as the schema is being created and updated and not generated. Rename …Model classes to just their name as types are package-private and not visible externally. Refactor SchemaDiff to Java record.

Use different overloads to write schema changes to avoid LiquibaseException leaking into cases where no diff is being used. Introduce SchemaFilter to filter unwanted mapped entities.

Move code to JDBC module. Introduce comparator strategy to customize how table and column names are compared.

See #756
Original pull request: #1520
2023-06-06 08:51:19 +02:00
Mark Paluch
549b807003 Polishing.
Reuse existing EvaluationContextProvider infrastructure and static parser/parser context instances. Parse expressions early. Update Javadoc to reflect SpEL support.

Reformat code to use tabs instead of spaces. Rename types for consistency. Rename SpelExpressionResultSanitizer to SqlIdentifierSanitizer to express its intended usage.

Eagerly initialize entities where applicable. Simplify code.

See #1325
Original pull request: #1461
2023-05-31 16:00:17 +02:00
Kurt Niemi
68a13fe12b Add SpEL support for @Table and @Column.
If SpEl expressions are specified in the `@Table` or `@Column` annotation, they will be evaluated and the output will be sanitized to prevent SQL Injections.

The default sanitization only allows digits, alphabetic characters, and _ character. (i.e. [0-9, a-z, A-Z, _])

Closes #1325
Original pull request: #1461
2023-05-31 16:00:17 +02:00
Jens Schauder
e0a0bb2b5d Do not prefix unsafe orer by expressions with table prefix.
Such expressions now get passed on unchanged.

This also deprecates org.springframework.data.r2dbc.query.QueryMapper.getMappedObject(Sort, RelationalPersistentEntity<?>).
It was only used in tests and translates an Order into another Order, which sounds wrong.

Closes #1512
Original pull request: #1513
2023-05-17 10:52:48 +02:00
Jens Schauder
a26557e76b Introduce SqlSort.
SqlSort allows the specification of unsafe order-by-expressions.
Order-by-expressions that are not declared unsafe are only accepted when they
either match a property or consist only of digits, letters, underscore, dot, or parentheses.

 Closes #1507
2023-05-12 10:54:17 +02:00
Mark Paluch
b945060753 Polishing.
Move off deprecated getRequiredLeafProperty() method in other places.

See #1489
2023-04-12 11:09:12 +02:00
Oliver Drotbohm
d68605b6d8 Adapt to API changes in Spring Data Common's PersistentPropertyPathAccessor.
Fixes #1477.
Related ticket: spring-projects/spring-data-commons#2813.
2023-04-04 11:45:38 +02:00
Jens Schauder
e78f7df53d Polishing.
Original pull request #1209
See #1110
2023-03-23 15:43:54 +01:00
Mikhail2048
d893259d4e Remove unnecessary parameters after moving of getReference(Identifier Processing).
Original pull request #1209
See #1110
2023-03-23 15:41:15 +01:00
Jens Schauder
58a67ceb2a Polishing.
Added `@author` tags.
Undo the change in behaviour of getReference(IdentifierProcessing).

See #1110
Original pull request #1458
2023-03-23 10:48:31 +01:00
Kurt Niemi
18eda61f15 Deprecate redundant getReference(IdentifierProcessing) method.
Closes #1110
Original pull request #1458
2023-03-23 10:45:49 +01:00
Mark Paluch
09189a4c41 Polishing.
Simplify TypeInformation creation from a MethodParameter.

Original pull request: #1356
See #1343
2023-03-15 17:02:10 +01:00
Jens Schauder
d1e039a387 Convert only contents of collections using StringBasedJdbcQuery.
Contents of Iterables that aren't collections will not be converted individually.

Closes #1343
Original pull request: #1356
2023-03-15 17:02:10 +01:00
Mark Paluch
637d06a9a0 Apply custom converter for Collection-like values in queries.
We now apply converters only for Collection-like values and no longer to Iterable types.

Closes #1452
2023-03-15 16:46:01 +01:00
Jens Schauder
0b85b6f216 Polishing.
Simplified use of queryMethod in the different JdbcQuery classes.
Improved method names.
Added author tags.
Code formatting.
Corrected HTML in JavaDoc.

Originial pull request #1423
2023-02-06 20:45:26 +01:00
Mikhail2048
468f94b312 Avoid superfluous creation of RowMappers.
For modifying queries RowMappers get now longer created.
Improved documentation for `@Query` annotation.

Original pull request #1423
2023-02-06 20:43:05 +01:00
Jens Schauder
c5c60dadde Polishing.
Original pull request #1403
See #1286
2023-01-30 13:57:41 +01:00
Mikhail2048
8eb80af044 Support of embedded properties in Sort.by.
Original pull request #1403
Closes #1286
2023-01-30 13:57:40 +01:00
Mark Paluch
82bc225b0b Polishing.
Simplify sanitizer. Add unit test.

See #1405
See #1406
Original pull request #1415
2023-01-26 09:40:40 +01:00
Jens Schauder
427fc4d83b SqlIdentifierParameterSource now sanitizes identifier names.
Closes #1405
See #1406
Original pull request #1415
2023-01-26 09:40:28 +01:00
Jens Schauder
e325c0152b Allow empty Iterable arguments in JdbcAggregateTemplate again.
This also affects repositories since they delegate to the template.

Closes #1401
2023-01-03 09:36:21 +01:00
Mark Paluch
3045225207 Extend license header copyright years to 2023.
See #1400
2023-01-02 09:53:43 +01:00
Jens Schauder
fb9a4f363d Polishing.
Original pull request #1396
See #1395
2022-12-22 15:58:43 +01:00
mhyeon-lee
d10be27485 Add insertAll and updateAll for JdbcAggregateOperations.
Original pull request #1396
Closes #1395
2022-12-22 15:58:42 +01:00
Jens Schauder
e590dceede Polishing.
Original pull request 1384
See #833
2022-11-29 14:46:44 +01:00
Viktor Ardelean
09f9da5128 Improved error message on missing back reference.
Closes #833
Original pull request 1384
2022-11-29 14:26:40 +01:00
Dmitriy
559a4488ea Add Transactional annotation to deleteAllById.
Original pull request #1370
2022-11-15 16:23:04 +01:00
Christoph Strobl
5fbc68ef87 Add Nullable annotation to parameter of overridden equals method.
Closes #1374
Original pull request #1375
2022-11-11 16:05:59 +01: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
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
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
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