Commit Graph

261 Commits

Author SHA1 Message Date
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
Jens Schauder
3cd25ee01f Introducing AfterConvertCallback/Event.
This is to replace the AfterLoadCallback/Event in order to match the naming of other store modules.

AfterLoadCallback/Event is still in place for now, but deprecated.

Closes #1053
Original pull request: #1060.
2021-10-01 10:33:59 +02:00
Mark Paluch
b02ee3c083 Polishing.
Encapsulate array support in JdbcArrayColumns.

See #1033
Original pull request: #1037.
2021-09-30 14:35:41 +02:00
Jens Schauder
933b2f125d Add the appropriate SQL type representation for floats in Postgres arrays.
Note that there is a separate problem with loading arrays of floats.

Original pull request #1037
See #1046
2021-09-30 14:35:34 +02:00
Jens Schauder
bc0d307415 SQL type used in array construction depends on Dialect.
Postgres requires the non standard type "FLOAT8" for "DOUBLE".
This is accomplished by making the conversion dependent on the dialect.

This required a new JdbcDialect interface in order to keep the JDBC annotation out of the relational module.

Closes #1033
Original pull request: #1037.
2021-09-30 14:35:03 +02:00
Mark Paluch
22e57fdffc Polishing.
See #1022
Original pull request: #1039.
2021-09-28 15:53:20 +02:00
Jens Schauder
cc6859b8b8 Fixes annotated named queries.
@Query.name wasn't considered when trying to find a named query for a query method.

Closes #1022
Original pull request: #1039.
2021-09-28 15:53:10 +02:00
Jens Schauder
f6eacf327c Support for in line queries for tables.
`InlineQuery` can be used wherever a `Table` was used up to now.

```
Table one = ...;
Select select = Select.builder()
		.select(one.column("id"), employee.column("name"))
		.from(one)
		.build();

InlineQuery inline = InlineQuery.create(select, "inline");
Select select = Select.builder()
		.select(inline.column("id"), inline.column("name"))
		.from(inline)
		.build();
```

Join and From renderer now use the same FromTableVisitor.
Also the SelectListVisitor reuses now the ExpressionVisitor.

Fixes #1003
Original pull request: #1018.
2021-09-28 10:50:51 +02:00
Christoph Strobl
d5e54b2036 Change visibility of JdbcRepositoryFactoryBean setters.
Setters of the FactoryBean are now public.

Closes #1031
2021-08-24 14:09:49 +02:00
Mark Paluch
f997a611d8 Polishing.
Remove Jackson in favor of JsonHolder and PGobject usage within the domain model. Convert spaces to tabs. Reorder methods and classes.

See #920
Original pull request: #1008.
2021-07-20 16:09:47 +02:00
Nikita Konev
d1e8e722c1 Consider PGobject as simple type.
Closes #920
Original pull request: #1008.
2021-07-20 16:09:38 +02:00
Mark Paluch
7d67f30bbd Polishing.
Tweak method names. Rebase onto main. Convert issue references to GH- from hash prefixed ones. Remove final keyword from variable and parameter declarations.

Original pull request: #999.
See #987
2021-07-15 12:04:53 +02:00
Jens Schauder
11734c1bcc Support AggregateReference in query derivation.
For a property of type AggregateReference one may provide an aggregate, an AggregateReference, or the id of the aggregate.

Closes #987
Original pull request: #999.
2021-07-15 12:04:53 +02:00
Mark Paluch
4f4014dc8e Polishing.
Hide actual converters by making these private classes, expose factory method to construct converters. Avoid stream API usage on converter code paths. Remove unused imports. Clean up tests.

Original pull request: #993.
See #992
2021-07-15 11:49:16 +02:00
Jens Schauder
221d11324f Convert AggregateReference by converters instead of custom code paths.
Closes #992
Original pull request #993
2021-07-15 11:49:07 +02:00
Jens Schauder
884332871e Unifying GitHub references to GH-nnn.
Original pull request #903
See #578
2021-07-02 11:07:27 +02:00
Jens Schauder
377d841284 Add documentation for streaming results.
Also us Github issue numbers on tests.

Original pull request #903
See #578, #971
2021-07-02 11:06:56 +02:00
Dennis Effing
c416d3d0ea Add support for streamed query results.
Use queryForStream for streamed query results.
Since ResultSetExtractor cannot be reasonably be used together with streams it falls back to the existing collection behaviour.

Closes #578
Original pull request #903
2021-07-02 11:06:38 +02:00
Jens Schauder
4c6894464e Fix derived queries with boolean literals.
`IsTrue` and `IsFalse` queries no longer use a literal in the query, but a bind parameter.
This allows Spring Data JDBC or the JDBC driver to convert the passed boolean value to whatever is required in the database.

For Oracle converter where added to support storing and loading booleans as NUMBER(1,0) where 0 is false and everything else is true.

Closes #908
Original pull request #983
2021-06-10 14:41:41 +02:00
Jens Schauder
8652418245 Do not convert from LocalDateTime to Timestamp by default.
Most supported databases don't need that conversion.

Db2 does need it and gets it through JdbcDb2Dialect.

As part of the effort it became obvious that the filtering for conversions between Date and JSR310 data types was broken.
It is fixed now, which required a dedicated reading conversion from LocalDateTime to Date for JdbcMySqlDialect.

Closes #974
Original pull request: #985.
2021-06-10 14:00:17 +02:00
Jens Schauder
2c413a2d3b Polishing.
See #934
2021-06-01 14:38:48 +02:00
Christoph Strobl
35589af3d3 Avoid conversion warnings for store specific simple types.
Dialects now can define a set of known simple types the driver can handle without further interaction. This is done to avoid warnings during converter registration for types known in one environment but not the other.
Also move types around a bit, change visibility and make sure jdbc specific dialects inherit converters from their parents.

Original pull request #981
See #935
2021-05-31 12:03:50 +02:00
Jens Schauder
6114d8e1fd Polishing.
Removes superfluous method.
Applied feedback from review: Formatting, Naming, and improved backward compatibility.

Originial pull request #981
See #935
2021-05-31 12:03:17 +02:00
Jens Schauder
33f08f7253 Support for Dialect specific custom conversions and OffsetDateTime.
Dialects may now register a list of converters to take into consideration when reading or writing properties.

See `JdbcSqlServerDialect` for an example.

By default `OffsetDateTime` does not get converted anymore.
If a database needs a conversion it can register it by implementing `Dialect.getConverters()` as described above.

Closes #935
Original pull request #981
2021-05-31 11:59:32 +02:00
Jens Schauder
261d5ebc67 Polishing.
Added Javadoc, removed superfluous code.

Original pull request #980
2021-05-18 15:16:21 +02:00
Jens Schauder
b99b4aaf2d Avoid unnecessary joins.
Original pull request #980
2021-05-18 15:16:21 +02:00
Mark Paluch
b3a2925573 Add support for repository query method projections.
JDBC repository methods now support interface and DTO projections by specifying either the projection type as return type or using generics and providing a Class parameter to query methods.

Closes #971
Original pull request #980
2021-05-18 15:16:20 +02:00
Mark Paluch
04fa01b8ee Polishing.
See #972
2021-05-17 11:44:05 +02:00
Mark Paluch
af755dc81b Move Identifier from Spring Data Relational to Spring Data JDBC.
Fix split-package between spring.data.jdbc and spring.data.relational across modules.

Closes #972.
2021-05-17 11:42:07 +02:00
Jens Schauder
1ca628922d Fixes build failures with JDK16.
`JdbcMappingContext` sets the SimpleTypeHolder to `JdbcSimpleTypeHolder.HOLDER` by default.
Fixing test failures where properties of type `UUID` were considered an entity by the `MappingContext`.
This in turn triggered failures when it tried to make fields of `UUID` accessible.

Removed the `UUID` field from a test entity in SD Relational, since `UUID` is not a simple type for Relational, nor a proper entity.

Replaced `@PostConstruct` with `InitializingBean` in test data source conifgurations in order avoid the requirement of importing javax.annotation-api.

Closes #975
2021-05-17 11:09:05 +02:00
Jens Schauder
920b2d47ef Upgrades MySql for testing to 8.0.24.
This version of the docker container doesn't allow to use `root` as the database user name.
We still have to connect as `root` so we can create alternative schemata.
2021-05-06 12:01:25 +02:00
Jens Schauder
44833531b9 Upgrade mysql driver to 8.0.23.
Original pull request: #961.
2021-04-14 08:33:19 +02:00
Jens Schauder
79923b66dc Polishing.
Tried to clarify the two step process of `JdbcQueryExecution` construction in `PartTreeJdbcQuery` by comments and renaming.

Original pull request #952
2021-04-06 19:20:10 +02:00
Mark Paluch
d191938e59 Add support for Slice and Page queries using query derivation.
We now support pagination for queries returning Slice and Page.

interface PersonRepository extends PagingAndSortingRepository<Person, String> {

  Slice<Person> findFirstByLastname(String lastname, Pageable pageable);

  Page<Person> findFirstByLastname(String lastname, Pageable pageable);
}

Closes #774
Original pull request #952
2021-04-06 19:20:10 +02:00
Mark Paluch
b6c41c68b3 Polishing.
Refactor ArrayUtil into a proper utility class providing toPrimitive and toObject methods for each primitive type. Add boolean support. Move convertToObjectArray to BasicJdbcConverter as its placement in ArrayUtils creates a certain amount of ambiguity over its actual purpose.

Create unit test.

See #945
Original pull request: #949.
2021-03-29 13:54:46 +02:00
Jens Schauder
55c6c0e858 Properly convert primitive array arguments.
Closes #945
Original pull request: #949.
2021-03-29 13:54:40 +02:00
Jens Schauder
53bed2613b Polishing.
Extract method in order to make the code more readable.

Switch to #xxx syntax for issue numbers instead of gh-xxx.

Original pull request #939
2021-03-12 12:05:20 +01:00
Radim Tlusty
304345c4c8 Don't retrieve generated keys on INSERT if id is set.
Closes #933
Original pull request #939
2021-03-12 11:53:11 +01:00
Jens Schauder
0e8e8a4799 Polishing.
Improves tests by also testing for the negative case.

Original pull request #938
2021-03-12 11:22:28 +01:00
Oliver Drotbohm
32d79cce59 Move to Spring Data Commons' association abstraction.
Deprecated Spring Data JDBC's custom PersistentProperty.isReference() in favor of the already existing ….isAssociation() with the same semantics to benefit from association definitions implemented in Spring Data Commons. Make use of the newly introduced PersistentEntity.doWithAll(…) to apply the previously existing property handling to both properties and now associations, too.

Original pull request #938
2021-03-12 11:22:28 +01:00
Oliver Drotbohm
faaaeab4b5 JdbcCustomConversion does not reject non-Date related default converters.
Previously, JdbcCustomConversion rejected any default converter that was not converting from and to java.util.Date. This probably stemmed from the fact that up until recently, Spring Data Commons' CustomConversions only registered date related default converters. As of spring-projects/spring-data-commons#2315 we also support jMolecules' Association and Identifier converters. We've relaxed the rejection to only explicitly reject all non Date/Time related converters if the conversion is from/to java.util.Date but allow everything else out of the box.

Original pull request #937
2021-03-12 08:58:40 +01:00
Jens Schauder
9a23493d72 Trigger BeforeConvertEvent when saving an aggregate.
Closes: #910
Original pull request: #913.
2021-01-19 09:41:59 +01:00
Jens Schauder
429f1b06b9 DATAJDBC-620 - Polishing.
Remove public modifier from tests, which is superfluous with JUnit 5.

Original pull request: #256.
2021-01-18 14:47:40 +01:00
Jens Schauder
3d4847a552 DATAJDBC-620 - The default RowMapper now gets passed to ResultSetConstructor.
Original pull request: #256.
2021-01-18 14:47:34 +01:00
Mark Paluch
394b1cec31 Update copyright year to 2021.
Closes #904
2021-01-12 11:32:07 +01:00
Jens Schauder
ba653183d1 #257 - Remove references to Jira.
All references to the Spring Jira instance are replaced by GitHub references.
2021-01-05 10:55:31 +01:00
Jens Schauder
2188b5d6cf DATAJDBC-637 - Fix tests for all databases.
Adds SQL scripts for all databases.
Separates tests for all databases vs. those that actually support nanosecond precision.

Original pull request: #255.
2020-12-11 08:16:55 +01:00
Greg L. Turnquist
306f1b39dd DATAJDBC-637 - Fix typo in H2 testing.
Original pull request: #254.
2020-12-11 08:16:43 +01:00