Commit Graph

437 Commits

Author SHA1 Message Date
Jens Schauder
42e786ca78 Fix Oracle database setup script.
Changed BIGINT to NUMBER.

See #1656
Original pull request #1663
2023-11-16 20:38:49 +01:00
Jens Schauder
15bb8d1eef Properly convert Map keys.
Keys of maps now get properly converted.
Among others this enables the use of enums as keys.

Closes #1656
Original pull request: #1663
2023-11-16 10:42:15 +01:00
Mark Paluch
5312731623 Reject Limit parameter using String-based queries.
Document limitations, add test cases for derived queries.

Closes #1654
2023-11-02 09:26:43 +01:00
Jens Schauder
6736d8334e Add conversion capabilities to the entity instantiator.
Closes #1646
2023-10-17 16:54:11 +02:00
Jens Schauder
8ba1204b2a Polishing.
Original pull request #1618
See #1554
2023-10-13 11:04:55 +02:00
Mark Paluch
5344197ba6 Fix identifier propagation for no-id list elements.
Original pull request #1618
See #1554
2023-10-13 10:28:30 +02:00
Mark Paluch
5398b94020 Deprecate Basic…Converter infrastructure.
Merge basic converters into Mapping…Converters and introduce deprecated variant to provide guidance for migration off the deprecated types.

Cleanup no longer required code.

Original pull request #1618
See #1554
2023-10-13 10:28:18 +02:00
Mark Paluch
4e3120ee0e Migrate JDBC to use RowDocument for reading aggregates.
Original pull request #1618
See #1554
2023-10-13 10:28:11 +02:00
Jens Schauder
9c36eb970b Fix MS Sql Server integration tests.
Closes #1638
2023-10-11 15:54:56 +02:00
Mark Paluch
a72bf1a65d Polishing.
Delegate BatchJdbcOperations calls to NamedParameterJdbcOperations. Refine since and deprecation tags.

See #1616
2023-10-11 09:54:44 +02:00
Jens Schauder
5d6d575ab2 Replace BatchJdbcOperations with Spring's NamedParameterJdbcOperations.
BatchJdbcOperations is still there, but deprecated, and not used except for deprecated places kept for backward compatibility.

This is possible since Spring Framework made the features offered by `BatchJdbcOperations` part of `NamedParameterJdbcOperations`.

Closes #1616
2023-10-11 09:54:44 +02:00
Jens Schauder
ddec3cc531 Adapt to new test infrastructure.
Originial pull request #1222
See #1220
See #1620
2023-10-10 08:34:05 +02:00
Jens Schauder
3b2e8c7a7e Upgrade to Mybatis Spring Version 2.1.0.
Closes #1220
Original pull request #1222
2023-10-10 08:33:33 +02:00
Mark Paluch
a555119f8b Polishing.
Remove Jetbrains annotation usage.

Simplify code, remove code that is commented out, extract methods, pass PersistentEntity as argument instead of creating instances that hold PersistentEntity as field to align the class lifecycle with its contextual usage.

Refactor AggregateReader lifecycle, use a single instance as there is no entity-specific state attached to AggregateReader.

Add Javadoc.

See #1448
Original pull request: #1622
2023-09-27 10:05:16 +02:00
Jens Schauder
9e41d25d15 Support Single Query Loading for aggregates with more than one collection.
Closes #1448
Original pull request: #1622
2023-09-27 10:04:55 +02:00
Mark Paluch
8fa9e3e1d5 Polishing.
Simplify type and interface arrangement.

See #1601
Original pull request: #1617
2023-09-26 14:40:01 +02:00
Mark Paluch
7b27d0e08c Add JMH benchmarks and optimizations to affected components.
See #1601
Original pull request: #1617
2023-09-26 14:40:01 +02:00
Jens Schauder
f3bc0af8c4 Polishing.
Simplify ValueFunction mapping. Remove invariants of findBy SQL generation in favor of the Condition-based variant. Reduce visibility. Change return value of AggregateReader to List

See #1601
Original pull request: #1617
2023-09-26 14:36:47 +02:00
Jens Schauder
0fdeaebbee Add support for arbitrary where clauses in Single Query Loading.
Closes #1601
Original pull request: #1617
2023-09-26 14:36:46 +02:00
Jens Schauder
6fb6110ca0 Remove dialect dependency from QueryMapper.
See #1601
Original pull request: #1617
2023-09-26 14:36:09 +02:00
Mark Paluch
610bc4521d Refine JDBC integration tests.
Introduce composed annotations and conditions to deduplicate annotations required for a test, to express database runtime conditions and database activation.
Simplify test configuration.
Split tests into unit test and integration test run.

Original pull request #1621
Closes #1620
2023-09-22 14:11:30 +02:00
Mark Paluch
1e20a32352 Polishing.
Tweak naming. Refine methods to static ones and collapse into a single method.

See #1615
2023-09-20 09:14:29 +02:00
Jens Schauder
bc644aa71c Fix RowDocumentIterator.hasNext.
This properly fixes the test setup, taking into account that @ActiveProfile by default replaces any profiles set via environment variable or system property.
It turns out that the hasNext calculation in RowDocumentIterator was wrong because

a) isBeforeFirst and isBeforeLast return both false when the ResultSet is empty.
b) isBeforeFirst and isBeforeLast aren't necessarily implemented for all ResultSets and for example DB2s ResultSet implementation don't support it by default.

Closes #1615
2023-09-20 09:14:29 +02:00
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
Jens Schauder
48b037fb9b Fix test setup for Single Query Loading.
The construction of the DataAccessStrategy happened before the MappingContext was properly setup.
This is now fixed.
A test utilizes Single Query Loading, if it activates the profile singleQueryLoading

Closes #1606
2023-09-08 12:10:05 +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
Jens Schauder
cf126d2d42 Remove lombok annotations.
Closes #1557
2023-07-10 14:57:19 +02:00
Mark Paluch
56ec491724 Fix tests after dependency upgrades.
See #1541
2023-07-04 14:39:23 +02:00
Jens Schauder
3cac9d1456 Updating Oracle version to Oracle Free 23.
The new image is configured as compatible with the old image, which it actually isn't.
The default database names are different, so we also set a database name that is different both from the one used by TestContainers as default and the one used by the Docker image.
If the TestContainers default is used the database is not found, because the image just creates the default one and the name doesn't mach.
If the Docker image default is used, the image creates its default database and then tries to create it again, which fails.

These workarounds may be removed once TestContainers properly supports the new image.

Closing #1528
2023-06-14 10:44:50 +02:00
Jens Schauder
147634a915 Polishing.
See #1460
Original pull request #1521
2023-06-13 16:09:45 +02:00
Vincent Galloy
fb97bfca97 Fix Enum[] type conversion.
Since 3.0.5, Enum[] type are detect as "UNKNOWN"

Closes #1460
Original Pull request #1521
2023-06-13 15:48:59 +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