Commit Graph

497 Commits

Author SHA1 Message Date
Jens Schauder
5fdfd3a9dc DATAJDBC-454 - Adds generics to events.
Events now have a type parameter for the type of aggregate root they relate to.
In order to utilize this an react to only events relating to a specific type of entity `AbstractRelationalEventListener` was added.

Original pull request: #199.
2020-03-19 09:21:56 +01:00
Jens Schauder
22f9eded60 DATAJDBC-454 - Redesigned events.
Ids are only contained if it can not be guaranteed that an entity is contained which applies to the delete events.
As a side effect Identifier got simplified into a single simple class.

Original pull request: #199.
2020-03-19 09:21:41 +01:00
Michal Fotyga
7a2a3fb2eb DATAJDBC-506 - Fix some typos in code and documentation.
Original pull request: #200.
2020-03-16 08:56:01 +01:00
Jens Schauder
b5344002eb DATAJDBC-486 - After release cleanups. 2020-03-11 09:57:42 +01:00
Jens Schauder
e83e2bb795 DATAJDBC-486 - Prepare next development iteration. 2020-03-11 09:57:41 +01:00
Jens Schauder
6c6a97e9b9 DATAJDBC-486 - Release version 2.0 M4 (Neumann). 2020-03-11 09:47:07 +01:00
Jens Schauder
de02336592 DATAJDBC-486 - Prepare 2.0 M4 (Neumann). 2020-03-11 09:46:29 +01:00
Jens Schauder
9788a69b5f DATAJDBC-486 - Updated changelog. 2020-03-11 09:46:16 +01:00
Mark Paluch
0ba523c780 DATAJDBC-503 - Adapt to Mockito 3.3 changes.
Mockito reports falsely unnecessary stubbings so we're switching to the silent runner for these cases.
2020-03-11 09:00:20 +01:00
Jens Schauder
4371aec0f9 DATAJDBC-490 - Polishing.
Renamed GroupedConditionVisitor to NestedConditionVisitor to match the renamed NestedCondition.

Original pull request: #193.
2020-03-10 10:21:02 +01:00
Mark Paluch
a184cd9e0e DATAJDBC-490 - Rename .group() to .nest() to avoid confusion with GROUP BY.
Original pull request: #193.
2020-03-10 10:20:55 +01:00
Mark Paluch
a4bf09e8e8 DATAJDBC-490 - Incorporate review feedback.
Rename ConditionGroup to GroupedCondition. Introduce Conditions.group(…) factory method instead of applying grouping via `condition.group()`. Introduce getter to introspect conditions.

Original pull request: #193.
2020-03-10 10:20:46 +01:00
Jens Schauder
c4f024bb50 DATAJDBC-490 - Added a test for combining multiple nested conditions.
Original pull request: #193.
2020-03-10 10:19:38 +01:00
Mark Paluch
0156fdd0bf DATAJDBC-490 - Support condition grouping.
We now support condition groups (WHERE (a = b OR b = c) AND (e = f)) with the SQL AST via Condition.group().

Original pull request: #193.
2020-03-10 10:18:51 +01:00
Mark Paluch
7956e2c915 DATAJDBC-472 - Updated changelog. 2020-02-26 11:55:05 +01:00
Mark Paluch
8e2c53e720 DATAJDBC-471 - Updated changelog. 2020-02-26 11:31:47 +01:00
Mark Paluch
188b9d4388 DATAJDBC-491 - Correctly combine schema- and table name.
We no correctly combine schema and table name using separate SqlIdentifier objects instead of leaving the schema name as part of the table name. Previously, the concatenated name failed to resolve with quoted identifiers.
2020-02-21 14:43:09 +01:00
Jens Schauder
c907eb1d35 DATAJDBC-488 - Polishing.
JdbcRepositoryConcurrencyIntegrationTests now only runs with MySql instead of always with MySql.
Also modified it to not use sleep.
Copyright header added.
Formatting.

Original pull request: #191.
2020-02-21 13:16:15 +01:00
mhyeon-lee
06529abf5a DATAJDBC-488 - Avoid deadlocks by first accessing the root entity.
The previous process of deleting referencing entities, updating the root and then inserting referencing entities hat the potential of causing deadlocks.
When one process didn't obtain a lock on delete because there wasn't anything to delete root and referencing entities got locks in opposite order, which is a classical cause for deadlocks.

Original pull request: #191.
2020-02-21 13:15:46 +01:00
Mark Paluch
95428b7022 DATAJDBC-492 - Use JdbcMappingContext in AbstractJdbcConfiguration instead of RelationalMappingContext.
We use now a more concrete type in the configuration to avoid clashes when Spring Data R2DBC is on the class path.
2020-02-20 10:20:46 +01:00
Mark Paluch
d1df76c8b8 DATAJDBC-474 - After release cleanups. 2020-02-12 15:04:22 +01:00
Mark Paluch
f3d5eca356 DATAJDBC-474 - Prepare next development iteration. 2020-02-12 15:04:21 +01:00
Mark Paluch
527d98734a DATAJDBC-474 - Release version 2.0 M3 (Neumann). 2020-02-12 14:47:16 +01:00
Mark Paluch
98c54ae7c1 DATAJDBC-474 - Prepare 2.0 M3 (Neumann). 2020-02-12 14:46:56 +01:00
Mark Paluch
eaf4fa189b DATAJDBC-474 - Updated changelog. 2020-02-12 14:46:48 +01:00
Jens Schauder
91ddda0c3f DATAJDBC-479 - Polishing.
Fixes compiler error from rebase rebase.
Removes IdentifierProcessingAdapter since it wasn't used anymore
Merged UnquotedDialect with NonQuotingDialect since both served the same purpose of a simple Dialect for testing.
Formatting.

Original pull request: #187.
2020-02-11 20:28:05 +01:00
Mark Paluch
592f483699 DATAJDBC-479 - Use SqlIdentifier in SQL AST.
We now use SqlIdentifier to encapsulate names and aliases of tables, columns and functions.

We now use proper delegation to ConditionVisitor to render a JOIN condition.
Previously, we used toString() of Condition segments which rendered an approximation of the condition.
ConditionVisitor applies RenderContext settings that consider identifier quoting and normalization strategies.

Original pull request: #187.
2020-02-11 20:26:57 +01:00
Jens Schauder
595559bf28 DATAJDBC-484 - Fixes a JDK dependent test failure.
Beginning from JDK 10 `Instant` uses nanosecond precision which doesn't make it through the database.
This caused the test to fail.
This fix fixes only the test by making the assertion more lenient.
Actually storing and retrieving nanosecond precision time values is a separate issue.

Also reduced logging in tests again.
2020-02-07 15:35:52 +01:00
taeyeonkim
fe181b2bd9 DATAJDBC-483 - Fixes small documentation issues.
Add anchor to section on JdbcValue in reference documentation.
Correct the type of `BeforeSaveEvent` in example code.

Original pull request: #189.
2020-02-07 11:31:07 +01:00
Jens Schauder
4a8888e296 DATAJDBC-101 - Polishing.
Refactored SQL generation.
Adapted some assertions to the "Spring Data JDBC style".
Minor formatting.

Original pull request: #188.
2020-02-07 10:29:11 +01:00
Milan Milanov
7f578ed2bb DATAJDBC-101 - Adds support for paging and sorting repositories.
Original pull request: #188.
2020-02-07 10:28:58 +01:00
Mark Paluch
f1d2d78dc8 DATAJDBC-464 - No longer require MappingContext to create BasicRelationalPersistentProperty.
We now no longer require MappingContext to create BasicRelationalPersistentProperty and BasicJdbcPersistentProperty.
We require only the NamingStrategy so we're just passing that one instead of the entire context.

Original pull request: #186.
2020-01-31 13:17:51 +01:00
Mark Paluch
b29a789846 DATAJDBC-464 - Move RelationalPersistentProperty.getColumnType() and getSqlType() to JdbcConverter.
RelationalPersistentProperty.getColumnType() and getSqlType() are no longer members of RelationalPersistentProperty but part of the JdbcConverter. Both methods have a strong affinity to JDBC-specifics and belong rather into the conversion strategy and not into mapping-metadata.

Original pull request: #186.
2020-01-31 13:17:49 +01:00
Mark Paluch
8de5683b71 DATAJDBC-464 - Polishing.
Fix generics. Reformat code. Improve method names.

Original pull request: #186.
2020-01-31 13:17:47 +01:00
Jens Schauder
5ed80dfdb6 DATAJDBC-464 - Convert parameters.
Parameters now get converted to a suitable type supported by JDBC.

In order to support this the logic of finding the "right" type got moved from `BasicRelationalPersistentProperty` to `JdbcCompatibleTypes`.

Original pull request: #186.
2020-01-31 13:17:37 +01:00
Jens Schauder
d77e9cd837 DATAJDBC-481 - Properly increase version of immutable aggregate roots on update. 2020-01-30 10:12:11 +01:00
Jens Schauder
2f9d4b2c83 DATAJDBC-481 - Improved test for optimistic locking version increase. 2020-01-30 10:12:11 +01:00
Mark Paluch
6825a64d56 DATAJDBC-478 - Expose arguments of SimpleCondition and SimpleFunction.
We now allow introspection by exposing the arguments as function arguments and the condition expression could be subject to mapping metadata mapping.
2020-01-28 14:15:15 +01:00
Jens Schauder
36b419e712 DATAJDBC-386 - Polishing.
Tests that used the `@Column` annotation to map multiple properties to a single database column failed.
Mapping multiple values to one column is possible to allow for entities inside an aggregate to have the id of the aggregate as ID or as part of the ID.

The reason for the test failures was that columns get referred to by different ways:
Once per DerivedSqlIdentifier (i.e. with normalized spelling).
And Once per `@Column` annotation.

SqlIdentifier from an `@Column` annotation have always the same spelling, while the normalized version depends on the `Dialect`.

In order to make the tests work for all databases all references to the column in question had to get a `@Column` annotation.
This in turn required the create scripts to also use quoting when the normal case of the database did not match the case chosen in the annotation.

Finally there were some tests that used hand coded SQL which now uses `SqlIdentifier` and an injected `Dialect` to arrive at the correct SQL syntax.

Removed a couple of `@Ignore` annotations that got left in the code.

Original pull request: #182.
2020-01-28 13:55:19 +01:00
Mark Paluch
b3d5f05258 DATAJDBC-386 - Refactor SqlIdentifier.
Fix bind marker rendering for delete by Id.

SqlIdentifier provides now a transform(…) method to transform its content instead of exposing prefix(…) and suffix(…) methods. Composite identifiers are created through SqlIdentifier.from(…) instead of exposing a concat(…) method.

We also now apply identifier normalization only to derived identifiers instead of applying normalization to annotated column and table names. This change requires references to derived field names to honor the appropriate letter casing.

Identifier quotation can be disabled globally, via RelationalMappingContext.setForceQuote(false).

Move SqlIdentifier to relational.core.sql package.

Original pull request: #182.
2020-01-28 13:54:54 +01:00
Jens Schauder
558e7386dc DATAJDBC-386 - Introduce quoting for all database identifier.
All database identifiers, i.e. table names, column names and so on, now get quoted.
For most databases this means they get enclosed with double quotes.
For some databases this makes the the identifiers case sensitive.
In order to minimize the impact we convert identifiers their default letter casing.
This should be upper case according to the SQL standard but isn't for some databases.

The exact behavior regarding quoting and default letter casing gets controlled by a database specific `Dialect`.

Future changes will make the quoting of annotated columns and the default quoting behavior configurable.

Original pull request: #182.
2020-01-28 09:22:17 +01:00
Mark Paluch
a7bb561dec DATAJDBC-473 - After release cleanups. 2020-01-17 09:47:50 +01:00
Mark Paluch
25745c8f05 DATAJDBC-473 - Prepare next development iteration. 2020-01-17 09:47:49 +01:00
Mark Paluch
d5e1a5ad9c DATAJDBC-473 - Release version 2.0 M2 (Neumann). 2020-01-17 09:39:03 +01:00
Mark Paluch
75dad11b60 DATAJDBC-473 - Prepare 2.0 M2 (Neumann). 2020-01-17 09:38:43 +01:00
Mark Paluch
d5157382bf DATAJDBC-473 - Updated changelog. 2020-01-17 09:38:34 +01:00
Mark Paluch
b85d0a71ee DATAJDBC-424 - After release cleanups. 2020-01-16 16:11:55 +01:00
Mark Paluch
baf8dec0a6 DATAJDBC-424 - Prepare next development iteration. 2020-01-16 16:11:54 +01:00
Mark Paluch
a46438de3b DATAJDBC-424 - Release version 2.0 M1 (Neumann). 2020-01-16 16:05:23 +01:00
Mark Paluch
48d8c2aa51 DATAJDBC-424 - Prepare 2.0 M1 (Neumann). 2020-01-16 16:05:03 +01:00