Commit Graph

141 Commits

Author SHA1 Message Date
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
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
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
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
eb1877140d DATAJDBC-469 - Bump version to 2.0.0. 2020-01-13 14:46:43 +01:00
Jens Schauder
09fd0fcbd6 DATAJDBC-234 - Fixes the default query naming and polishing.
The default name now does include the name of the domain class.
The default name now is no longer used when no query with the name specified in the `@Query` annotation is found.

Simplified the unit tests by extracting common functionality and improving naming.
Simplified test configuration.

Original pull request: #180.
2020-01-08 15:40:11 +01:00
mcisnerosb57
93272c8461 DATAJDBC-234 - Adds support for named queries stored in property files.
Queries are expected in a properties file on the classpath `META-INF/jdbc-named-queries.properties`.
The name of the query is by default `<simple class name of the domain type>.<methodName>`.
Alternatively it can be set using the `@Query` annotations `name` attribute.

Original pull request: #180.
2020-01-08 15:38:15 +01:00
Mark Paluch
a30fbf6246 DATAJDBC-466 - Update copyright years to 2020. 2020-01-07 08:50:23 +01:00
Jens Schauder
0fa780eccc DATAJDBC-462 - Adds a test to ensure that aggregates can be saved twice without any change. 2019-12-17 09:52:07 +01:00
Jens Schauder
a48b66743e DATAJDBC-461 - DatabaseProfileValueSource now supports setting via Environment. 2019-12-17 08:11:35 +01:00
Jens Schauder
ca2d2182d2 DATAJDBC-219 - Polishing.
DeleteWithVersion doesn't require an entity anymore.
Added the `@author` and `@since` tags where they were missing.
Formatting.
Added documentation.

Original pull request: #166.
2019-12-02 08:56:33 +01:00
Tyler Van Gorder
f7a04dcc2b DATAJDBC-219 - Implements optimistic record locking.
Optimistic locking is based on a numeric attribute annotated with `@Version` on the aggregate root.
That attribute is increased before any save operation and checked during updates to ensure that the database state hasn't changed since loading the aggregate.

Original pull request: #166.
2019-12-02 08:55:21 +01:00
Jens Schauder
92b6b0486c DATAJDBC-438 - Polishing.
Code style.
Choose better matching exception.
2019-11-13 13:02:44 +01:00
mhyeon-lee
dfaf0ac2e6 DATAJDBC-438 - Throw an exception if a save operation updates zero rows.
Original pull request: #178.
2019-11-13 13:02:44 +01:00
Jens Schauder
3e4e874aa8 DATAJDBC-431 - Polishing.
Improved and corrected nullability annotations. Fixed broken Javadoc.

Original pull request: #175.
2019-10-25 10:00:40 +02:00
Jens Schauder
1774e3a3a7 DATAJDBC-431 - ReadOnlyProperty now no longer written.
The problem was that the SqlGenerator honored the annotation but they were included as query parameters and therefore automatically added back again.

Also:

* Simplified the relevant filter in the SqlGenerator.
* Introduced a meta annotation for running tests only agains HsqlDb.

Original pull request: #175.
2019-10-25 10:00:12 +02:00
Mark Paluch
9e0f930da7 DATAJDBC-437 - Polishing.
Remove unused imports.

Original pull request: #177.
2019-10-25 09:54:24 +02:00
Jens Schauder
8f495891a2 DATAJDBC-437 - In strict mode we only claim repositories for domain types with @Table annotation.
Before this change Spring Data JDBC didn't specify any identifying annotation and therefore would claim all or no repository depending on the the version of Spring Data Commons.

Also added the RepositoryFactorySupport to spring.factory in order to support detection of multiple RepositoryFactorySupport implementations on the classpath.

Related ticket: DATACMNS-1596.
Original pull request: #177.
2019-10-25 09:53:54 +02:00
Jens Schauder
b74c82c724 DATAJDBC-436 - Replace @Wither with @With.
lombok.experimental.Wither is now deprecated and to be replaced by lombok.With which this change does.
2019-10-21 08:47:31 +02:00
Jens Schauder
c5c2d49b15 DATAJDBC-432 - Polishing.
Null handling in test.
2019-10-21 08:18:55 +02:00
Jens Schauder
7d8c78e9ec DATAJDBC-432 - Extracted AggregateChangeExecutor from AggregateChange.
This separates the execution plan of  a change encoded in the AggregateChange from its execution encoded in the AggregateChangeExecutor.
2019-10-21 08:18:55 +02:00
Jens Schauder
448f0e0d39 DATAJDBC-428 - Polishing.
Code formatting.
2019-10-16 14:34:24 +02:00
Jens Schauder
6e715cb6b3 DATAJDBC-427 - Polishing.
Used isEqual assertions instead of directly calling equals.
Code formatting.
2019-10-16 14:32:17 +02:00
mhyeon-lee
cef41525da DATAJDBC-428 - Fixes BasicJdbcConverter readValue for immutable entity with AggregateReference field.
Original pull request: #172.
2019-10-16 12:09:00 +02:00
mhyeon-lee
a6b3144e66 DATAJDBC-427 - IdOnlyAggregateReference no supports equality.
Original pull request: #172.
2019-10-16 12:08:02 +02:00
Mark Paluch
1314081c52 DATAJDBC-291 - Polishing.
Introduce factory methods for AggregateChange save/delete object creation. Replace computeIfAbsent pattern with appropriate methods. Add indirection for staged values traversal. Rename CascadingValuesLookup to StagedValues.
Javadoc, formatting.

Original pull request: #173.
2019-10-15 15:53:00 +02:00
Jens Schauder
feb60c8560 DATAJDBC-291 - Setting DB-generated ids now works across collections.
Original pull request: #173.
2019-10-15 15:52:47 +02:00
Mark Paluch
9277797d37 DATAJDBC-403 - Prepare next development iteration. 2019-09-30 16:17:28 +02:00
Mark Paluch
2c356f6346 DATAJDBC-403 - Release version 1.1 GA (Moore). 2019-09-30 15:51:07 +02:00
Jens Schauder
8feb7fbf71 DATAJDBC-413 - Polishing.
Removed excessive logging in tests.
Again.
2019-09-13 09:12:26 +02:00
Jens Schauder
1fe39cf1c9 DATAJDBC-413 - Use proper https URLs for MyBatis DTDs.
See also: https://github.com/mybatis/mybatis-3/issues/1559
2019-09-13 09:08:02 +02:00
Mark Paluch
4d1fff1c19 DATAJDBC-411 - Set project.root in module poms to correctly generate Javadoc.
By setting project.root, Javadoc is aggregated in the parent pom target so it can be collected during the distribution build.

Original pull request: #168.
2019-09-12 07:54:26 +02:00
Mark Paluch
5380daac6f DATAJDBC-404 - Prepare next development iteration. 2019-09-06 10:21:54 +02:00
Mark Paluch
c2f11ed104 DATAJDBC-404 - Release version 1.1 RC3 (Moore). 2019-09-06 10:10:42 +02:00
Mark Paluch
2f28153471 DATAJDBC-388 - Prepare next development iteration. 2019-08-05 15:53:01 +02:00
Mark Paluch
10ae98a572 DATAJDBC-388 - Release version 1.1 RC2 (Moore). 2019-08-05 15:35:35 +02:00
Oliver Drotbohm
5a8abe73e6 DATAJDBC-399 - Performance improvements in metadata lookups.
Avoid Stream usage in favor of a simple for loop in event triggering in JdbcAggregateTemplate. Tweaked JdbcMappingContext to verify the presence of parameter names on metadata creation. Avoid the re-resolution of the column name for a property by caching the resolved column name. This significantly improves performance as it avoids repeated parsing and concatenation of strings. Added caching to PersistentPropertyPathExtension.
2019-07-30 17:15:53 +02:00
Mark Paluch
1fb404a84e DATAJDBC-400 - Polishing.
Add version since which deprecations are in place. Inline variables.

Original pull request: #164.
2019-07-29 14:15:12 +02:00
Jens Schauder
2289195e8a DATAJDBC-400 - Remove Identifier from callbacks.
Retrieval of the Identifier has been shown to cost significant performance.

Original pull request: #164.
2019-07-29 14:14:37 +02:00
Mark Paluch
4ab69a10f7 DATAJDBC-398 - Polishing.
Convert space indent to tabs.

Original pull request: #163.
2019-07-26 12:35:07 +02:00
Jens Schauder
5e8161dbf3 DATAJDBC-398 - SimpleJdbcRepository methods are now transactional.
Original pull request: #163.
2019-07-26 12:34:56 +02:00
Jens Schauder
1d91d839b7 DATAJDBC-393 - Added missing create table script for integration tests. 2019-07-17 10:23:09 +02:00
Mark Paluch
257dd7d5d4 DATAJDBC-393 - Polishing.
Accept AggregateChange in BeforeSave and BeforeDelete callbacks. Add Javadoc. Fix generics usage in RelationalAuditingCallback. Align documentation for consistent entity callback documentation.

Add overloaded JdbcAggregateTemplate constructor to directly configure EntityCallbacks.

Original pull request: #161.
2019-07-16 13:09:08 +02:00
Jens Schauder
1a9612c64f DATAJDBC-393 - EntityCallback support.
An `EntityCallback` works very similar to an `ApplicationEvent` but returns a potentially changed instance.
The returned instance will be used in further processing which enables proper event handling for immutable classes.

Auditing was changed to use a callback making it work also with immutable objects.

Original pull request: #161.
2019-07-16 13:08:44 +02:00