Commit Graph

138 Commits

Author SHA1 Message Date
Michal Fotyga
485ef495a4 DATAJDBC-506 - Fix some typos in code and documentation.
Original pull request: #200.
2020-03-16 09:01:05 +01:00
Jens Schauder
1da008f331 DATAJDBC-485 - Fixes the Travis build.
Uses the .travis.yml from the master branch.
But without the check for the microsoft license acceptance which isn't present here.
Changes one test to not be dependent on nanosecond precision of time values.
2020-02-07 16:32:02 +01:00
Mark Paluch
4907a64c76 DATAJDBC-466 - Update copyright years to 2020. 2020-01-07 08:50:24 +01:00
Mark Paluch
75af137d96 DATAJDBC-437 - Polishing.
Remove unused imports.

Original pull request: #177.
2019-10-29 07:12:48 +01:00
Jens Schauder
593a19a4fb 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-29 07:12:48 +01:00
Jens Schauder
2f1f6d04be DATAJDBC-296 - Polishing.
Moved test into existing class.

Original pull request: #109.
2019-10-29 07:12:48 +01:00
Bastian Wilhelm
4daba8d745 DATAJDBC-296 - The value of the @Table annotation is now optional.
The default ("") is equivalent to no annotation at all, i.e. the `NamingStrategy` determines the table name.

Original pull request: #109.
2019-10-29 07:12:48 +01:00
Jens Schauder
4d8280427f DATAJDBC-413 - Use proper https URLs for MyBatis DTDs.
See also: https://github.com/mybatis/mybatis-3/issues/1559
2019-09-13 09:18:05 +02:00
Mark Paluch
baf4689d05 DATAJDBC-390 - Polishing.
Slightly tweak Javadoc.

Original pull request: #159.
2019-07-15 11:38:24 +02:00
Jens Schauder
3209747434 DATAJDBC-390 - Add ordering to RelationalAuditingEventListener to run before other listeners without explicitly specified order.
When an event listener is used to set an id before saving it, this ensures the auditing happens before setting the id.
If this is not ensured the auditing listener doesn't consider the entity as new and doesn't set created date and created by user.

Original pull request: #159.
2019-07-15 11:36:14 +02:00
Jens Schauder
1df826d44d DATAJDBC-383 - preliminary fix for not using http for MyBatis DTDs.
Currently there seems to be now well maintained https resource for MyBatis DTDs.
We therefore use the tagged sources directly for now.

See also: https://github.com/mybatis/mybatis-3/issues/1559
2019-06-18 11:04:26 +02:00
Christoph Strobl
7690cef4e0 DATAJDBC-378 - Polishing
Move non integration tests to separate class.

Original Pull Request: #155
2019-06-13 10:34:03 +02:00
Spring Operator
ef944e6132 DATAJDBC-336 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 127 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).

Original Pull Request: #135
2019-03-22 11:20:50 +01:00
Jens Schauder
d97b0002fd DATAJDBC-334 - Polishing.
Original pull request: #120.
2019-02-19 10:03:38 +01:00
Bastian Wilhelm
c78bfae44a DATAJDBC-334 - Fixes broken parameter names for quoted column names.
When a column has a quoted name it contains characters illegal for parameter names.
Therefore the parameter names now get sanitised.

Compared to the version on master testing is more lenient.
This accounts for the SqlGenerator behaving slightly different then on master.

Original pull request: #120.
See also: https://jira.spring.io/browse/DATAJDBC-262.
2019-02-19 10:03:38 +01:00
Mark Paluch
5389c07fac DATAJDBC-313 - Update copyright years to 2019. 2019-01-02 13:56:20 +01:00
Jens Schauder
cdab323506 DATAJDBC-303 - Made test stable against rounding errors. 2018-12-17 14:09:32 +01:00
Jens Schauder
054c32c7f4 DATAJDBC-294 - Fixed handling of Id names in WHERE-clauses.
RelationalPersistentEntityImpl.getIdColumn wasn’t respecting @Column annotations.
2018-11-15 13:20:38 +01:00
Jens Schauder
8510c640c1 DATAJDBC-263 - Polishing.
Improved formatting, added author tags and issue comments.
Changed "entity" to "aggregate" in test names to make it more precise.

Original pull request: #94.
2018-10-15 08:45:37 +02:00
Maciej Walkowiak
ce9ade6d7c DATAJDBC-263 - Publish events for @Query annotated methods.
Original pull request: #94.
2018-10-15 08:45:30 +02:00
Jens Schauder
84de41a87d DATAJDBC-264 - Polishing.
Added a test.
Added an author tag.
Minor formatting.

Original pull request: #88.
2018-09-18 15:35:52 +02:00
Jens Schauder
08ee846e71 DATAJDBC-218 - The Column annotation affects the back reference too.
Also:
Added documentation for the new behavior.
Made the value of the column annotation optional by providing a default.

Original pull request: #83.
2018-09-18 15:25:55 +02:00
Jens Schauder
335a7cbe65 DATAJDBC-218 - Polishing.
Added line breaks for better readability.
Added braces to if/else statements.
Used StringUtils instead of .equals("").

Original pull request: #83.
2018-09-18 15:05:36 +02:00
Florian Lüdiger
0a86f3a43b DATAJDBC-218 - Add support for key column in @Column annotation.
Original pull request: #83.
2018-09-18 15:05:36 +02:00
Oliver Gierke
3cbe2935ba DATAJDBC-252 - Make sure SimpleJdbcRepository.save(…) returns saved instance.
Previously, SimpleJdbcRepository.save(…) returned the original instance as result of the operation. That assumed that the JdbcAggregateOperations would only manipulate that instance, not return a new one. We now properly return the result of the delegating method call.
2018-08-21 12:03:38 +02:00
Jens Schauder
2a55aeb2b8 DATAJDBC-252 - Optimize population of (immutable) entities to be created.
The entity creation not skips the property population entirely if the metamodel indicates that the instantiation already creates a complete entity. If there's need to actively populate properties, we now correctly skip the ones already consumed by the constructor.

Original pull request: #86.
2018-08-21 11:04:23 +02:00
Jens Schauder
55c901b43b DATAJDBC-251 - Back-reference for dependent entity gets properly set.
If a parent DbAction does not offer a generated id, the id of the entity is used instead. This behavior was broken by DATAJDBC-241.

Related tickets: DATAJDBC-241.
Original pull request: #85.
2018-08-20 22:26:49 +02:00
Jens Schauder
e398db544c DATAJDBC-241 - Support for immutable entities.
Immutable entities can now be saved and loaded and the immutability will be honored.

This feature is currently limited to a single level of reference.

In order to implement this the logic for updating IDs with those generated from the database got moved out of the DefaultDataAccessStrategy into the AggregateChange.
As part of that move DataAccessStrategy.save now returns a generated id, if available.

See also: DATAJDBC-248.
2018-08-20 09:42:22 +02:00
Jens Schauder
4c179a93ec DATAJDBC-229 - Added UUID.class as simple type.
Also made RelationalMappingContext actually use the JdbcSimpleTypes.

In order for this to work the database needs to be able to handle parameters of type UUID and store them either as such or internally convert them.
Currently no conversion by Spring Data JDBC happens.

Original pull request: #76.
2018-07-27 14:37:45 +02:00
Toshiaki Maki
21c9bd2144 DATAJDBC-229 Added test demonstrating java.util.UUID is not a simple type.
Original pull request: #76.
2018-07-27 14:33:07 +02:00
Jens Schauder
1085918135 DATAJDBC-233 - Changed API in order to support immutable entities.
Note: Immutable entities still aren't supported yet, these are just the API changes plus implementations that work for mutable entities.

The API of DbActions will need further evolution.

Original pull request: #80.
2018-07-25 09:26:32 +02:00
Mark Paluch
12d539a017 DATAJDBC-227 - Polishing.
Return List<DbChange<?>> in RelationalEntityWriters so AggregateChange can be assembled in less places to reduce the number of abstractions per method. Change ResultOrException in FunctionCollector to static class so instances no longer retain a reference to their enclosing class. Fix DbAction generics in AggregateChange. Replace simple constructors with Lombok usage. Javadoc, typos, formatting.

Original pull request: #79.
2018-07-19 15:34:01 +02:00
Jens Schauder
bdefd3da9a DATAJDBC-227 - Refactored JdbcEntityWriter and DbActions.
JdbcEntityWriter and JdbcDeleteEntityWriter now use an iterative approach based on PersistentPropertyPath instead of a recursive one.

DbAction is now split into multiple interfaces representing different variants of actions.
The implementations are simple value types without any implementation inheritance hierarchy.
All elements of a DbAction implementation are not null making usage and construction of instances much easier.

Original pull request: #79.
2018-07-19 15:33:46 +02:00
Mark Paluch
2c5489b070 DATAJDBC-235 - Incorporate feedback from review.
Refactor ResultSetParameterValueProvider into Function<Parameter, Object>. Remove unnecessary assertions.
2018-07-19 10:38:52 +02:00
Mark Paluch
fb858bf1b1 DATAJDBC-235 - Add support for configurable conversion.
We now support configurable conversion by introducing CustomConversions and RelationalConverter. CustomConversions is a registry for converters that should be applied on a per-type basis for properties. CustomConversions is typically registered as bean and fed into RelationalMappingContext and the newly introduced RelationalConverter to consider simple types and conversion rules.

RelationalConverter with its implementation BasicRelationalConverter encapsulates conversion infrastructure such as EntityInstantiator, CustomConversions, and MappingContext that is required during relational value conversion. BasicRelationalConverter is responsible for simple value conversion and entity instantiation to pull related code together. It's not in full charge of row result to object mapping as this responsibility remains as part of DataAccessStrategy.

This change supersedes and removes ConversionCustomizer.
2018-07-19 10:38:52 +02:00
Oliver Gierke
9991946d92 DATAJDBC-226 - Renamed all types named Jdbc… in relational package Relational…. 2018-06-22 15:40:32 +02:00
Oliver Gierke
8a67e52b61 DATAJDBC-226 - Extracted packages not directly tied to JDBC into separate package. 2018-06-22 15:33:13 +02:00
Jens Schauder
0a0e774129 DATAJDBC-137 - Fixes warnings and improves Javadoc.
All packages now use @NoNullApi.
All warnings related to that fixed, except a few cases where upstream annotations are simply wrong.
Added null checks.
Fixed generic types where possible.
Improved Javadoc.
Code Formatting.
2018-06-11 16:15:52 +02:00
Jens Schauder
b91da91a83 DATAJDBC-102 - Polishing.
Execute Hsql specific integration test only with Hsql.

Original pull request: #68.
2018-06-04 16:12:59 +02:00
Jens Schauder
0ebb4a7799 DATAJDBC-102 - Determine the EntityInstantiator to be used dynamically.
Replaced the direct use of EntityInstantiator with EntityInstantiators.
Moved it into the MappingContext because instantiation is part of the mapping process.

Original pull request: #68.
2018-06-04 16:12:59 +02:00
Oliver Gierke
fca2ef6629 DATAJDBC-137 - Improve EntityInformation usage.
Moved to both the usage of the newly introduced PersistentEntity.isNew(…) and identifier lookups via PersistentEntity instead of using a custom EntityInformation implementation. JdbcRepositoryFactory now creates a PersistentEntityInformation, SimpleJdbcRepository simply works with a PersistentEntity.

Removed references to EntityInformation (a repository subsystem concept) from the template implementation. Removed BasicJdbcPersistentEntity and its tests entirely. JdbcAuditingEventListener is now using an IsNewAwareAuditingHandler.

Related tickets: DATACMNS-1333.
2018-05-31 22:28:06 +02:00
Jens Schauder
6bf916b9c4 DATAJDBC-207 - Polishing.
Formatting.
2018-05-23 15:24:43 -05:00
Jens Schauder
b4b6625d50 DATAJDBC-207 - Default NamingStrategy is now Snake Case.
Moved the implementation from the DelimiterNamingStrategy into the NamingStrategy.
Dropped the support for different separators, since there is no good way to support it in the default implementations of an interface.
A getSeparator() method would bleed into the public API.
Also the added value of that flexibility seems limited.

During migration of the various test it became obvious that SqlGeneratorUnitTests was broken since test failures happend on a worker thread not on the main test thread.
This is fixed as well with this commit.
2018-05-23 15:24:35 -05:00
Jens Schauder
0460f2f509 DATAJDBC-188 - Ensure proper behavior of delete logic.
No behavior changed.
Added tests on various levels for deleting entities with references to other entities.
2018-05-23 15:15:50 -05:00
Jens Schauder
01478cc53d DATAJDBC-143 - Removed domain type parameter form JdbcEntityOperations.save().
Such a parameter would only make sense with inheritance and we don't support inheritance at all in the moment.
Anything we need in order to support inheritance should be added once we do support inheritance.
2018-05-23 15:05:09 -05:00
Jens Schauder
387c3eca18 DATAJDBC-220 - Added a Degraph test for inter module dependencies.
The existing test only analysed Spring Data JDBC itself.
The new test also considers packages from commons and treats

    org.springframework.data.x.X

and

    org.springframework.data.jdbc.x.Y

as belonging to the same "sub-module" "x".
2018-05-22 15:41:21 +02:00
Oliver Gierke
e4de5701d4 DATAJDBC-138 - Polishing.
Moved all types from mapping.model into model to align with the setup of other Spring Data modules.

Original pull request: #67.
2018-05-18 16:35:13 +02:00
Jens Schauder
bd7401b665 DATAJDBC-138 - Improve package structure and naming.
Moved SimpleJdbcRepository into support package.
Moved mapping package under core.
Renamed JdbcEntityOperations to JdbcAggregateOperations.
2018-05-18 16:35:13 +02:00
Oliver Gierke
d0a8af21a3 DATAJDBC-137 - Polishing.
Moved the dependency to NamedParameterJdbcOperations out of JdbcMappingContext. This revealed that despite the DataAccessStrategy abstraction, there are a couple of places in the query execution subsystem that work with a plain NamedParameterJdbcOperations instance, so that we now have to carry that around all the way from the repository factory bean. Improving that is subject for further changes.

A bit of JavaDoc and generics polish here and there.
2018-05-18 15:11:27 +02:00
Oliver Gierke
fbc271a83a DATAJDBC-106 - Polishing.
Moved annotation processing of @Table and @Column into metamodel classes so that the NamingStrategy is only responsible for generic fallbacks. Allow @Column to be used as meta-annotation.
2018-05-18 13:57:46 +02:00