Commit Graph

392 Commits

Author SHA1 Message Date
Jens Schauder
dcd4ef0cdc Support readonly properties for references.
The `@ReadOnlyProperty` annotation is now honoured for references to entities or collections of entities.

For tables mapped to such annotated references, no insert, delete or update statements will be created.
The user has to maintain that data through some other means.
These could be triggers or external process or `ON DELETE CASCADE` configuration in the database schema.

Closes #1249
Original pull request #1250
2022-05-23 10:42:31 +02:00
Jens Schauder
274fcd7e87 Polishing.
Original pull request #1226
See #1212
2022-05-17 14:43:58 +02:00
Chirag Tailor
64a7c5595a Update @Query argument conversion to handle Collection<Enum>.
+ Copy logic from QueryMapper#convertToJdbcValue to resolve Iterable
  arguments on findBy* query methods to resolve the same for @Query.
+ Use parameter ResolvableType instead of Class to retain generics info.

Original pull request #1226
Closes #1212
2022-05-17 14:43:04 +02:00
Jens Schauder
e6ff3859ed Drop support for H2 1.x.
Closes #1243
2022-05-16 14:00:09 +02:00
Christoph Strobl
b671f48a2c Prepare next development iteration.
See #1206
2022-05-13 10:53:24 +02:00
Christoph Strobl
4e82d9d496 Release version 3.0 M4 (2022.0.0).
See #1206
2022-05-13 10:44:01 +02:00
Jens Schauder
f6d31eeb4c Downgrade to mybatis-spring 2.0.7.
Since at the time of the release only snapshot releases of mybatis-spring 2.1 are available we decided to downgrade to 2.0.7. for the release.

Unfortunately that release is not compatible with the current milestone of Spring Framework and therefore the MyBatis integration is broken.

If you want to use MyBatis with this release, manually add a dependency to mybatis-spring 2.1.0-SNAPSHOT.

Closes #1245
2022-05-13 09:14:44 +02:00
Jens Schauder
4353dc8e06 Improve and clarify documentation of callbacks.
This also removes deprecated Events and Callbacks.

Closes #1236
2022-05-11 15:45:03 +02:00
Jens Schauder
f2dc64ec52 Polishing.
Formatting and comments.

See #1201
See #1199
Original pull request #1208
2022-03-29 10:10:11 +02:00
Chirag Tailor
508791b7df Capture execution results for update db actions to fix root references with immutably typed ids.
+ Added #getIdValueSource to DbAction.WithEntity since it now applies to all such DbAction.
+ Removed DbAction.WithGeneratedId in favor of DbAction.WithEntity where it was used.

Removes unused DbAction.Update.

Passes the root from BeforeSaveCallback through to InsertRoot,UpdateRoot
actions.

+ Isolate aggregate change #getEntity #setEntity behaviors into a new
interface for "save" changes.
+ Extract #setEntity from DbAction.WithEntity to a new DbAction interface
just for root actions.
+ JdbcAggregateChangeExecutionContext#populateIdsIfNecessary returns the root entity
from DbAction.InsertRoot or DbAction.UpdateRoot regardless of the immutability of
its @Id property.

Closes #1199
Closes #1201
Original pull request #1208
2022-03-29 10:07:54 +02:00
Jens Schauder
657e9cac65 Polishing.
Changed default behaviour to an empty name for embedded entities.
This allows to use embedded entities for column tuples without special prefix.

Original pull request #1149
2022-03-23 15:31:59 +01:00
Daniil Razorenov
b53e4e6091 Fix assemble table alias for embedded entity with empty prefix and reference.
Table alias for embedded entity use prefix value from Embedded annotation. But default value for prefix is empty string. If try to create SqlIdentifier for empty string it throw exception. To avoid this behavior, if prefix is an empty string, property name for embedded entity is taken instead.
2022-03-23 15:31:59 +01:00
Jens Schauder
a4d2f1ef05 Polishing.
This change extracts entity modifying behaviour into separate methods, so it doesn't appear as an unexpected side effect of the creation of aggregate changes.

Also some formatting.

Original pull request #1196
See #1137
2022-03-22 17:10:41 +01:00
Chirag Tailor
6500bfed3a Determine and set the value for entity @Version before conversion to DbActions to simplify execution context.
This change incorporates one test from https://github.com/spring-projects/spring-data-relational/pull/1150

Original pull request #1196
Closes #1137
2022-03-22 17:10:41 +01:00
Mark Paluch
86e36b08f6 Prepare next development iteration.
See #1205
2022-03-22 14:07:37 +01:00
Mark Paluch
755dc05502 Release version 3.0 M3 (2022.0.0).
See #1205
2022-03-22 14:00:24 +01:00
Mark Paluch
8aeb9bfb97 Prepare next development iteration.
See #1132
2022-03-21 16:44:40 +01:00
Mark Paluch
7f2534a384 Release version 3.0 M2 (2022.0.0).
See #1132
2022-03-21 16:35:09 +01:00
Mark Paluch
32ec464572 Disable package cycle tests.
Property Converters introduced a cycle so we're disabling the tests for now as we cannot resolve these from here.

See #1132
2022-03-21 08:47:36 +01:00
Jens Schauder
e019b3695a Polishing.
Formatting.

See #1159
Original pull request # 1191
2022-03-16 14:28:01 +01:00
Chirag Tailor
226bb71708 Batch inserts of referenced entities.
Insert for entities of same type within an aggregate get inserted using JDBC batch operations when possible.

Inserts are supported when no id needs to be generated by the database or if the Dialect supports generation of ids in batch operations.

Closes #1159
Original pull request # 1191
2022-03-16 14:27:44 +01:00
Jens Schauder
325d9cc89c Polishing.
Run tests only for a single database since it is actually not testing anything database related.

Formatting.

Original pull request #1187
See #1043
2022-03-07 15:11:27 +01:00
Diego Krupitza
246343f477 Introduced queryLookupStrategy to EnableJdbcRepositories.
Added the missing functionality that is found in the documentation of spring-data-jdbc, but was not present in the code as functionality. Users can not choose between various QueryLookupStrategies.

Closes #1043
Original pull request #1187
2022-03-07 15:11:13 +01:00
Mark Paluch
05e96557bd Associate value with isTrue/isFalse criteria operators.
We now associate a boolean value with both operators as those operators are rendered using equals comparison in the actual SQL text.

Orginal pull request #1188
2022-03-01 14:41:14 +01:00
Jens Schauder
4edb39800e Move Lock to relational module.
This allows both Spring Data R2DBC and Spring Data JDBC to use the same annotation.

See spring-projects/spring-data-jdbc/issues/1041, spring-projects/spring-data-r2dbc/pull/720, spring-projects/spring-data-jdbc/pull/1158
2022-02-22 16:17:22 +01:00
Jens Schauder
a4e04dde56 Avoid conversion when return value is null.
Closes #1167
2022-02-21 15:16:28 +01:00
Mark Paluch
9a42776381 Import Spring Data R2DBC module into Spring Data Relational.
Closes #1179
2022-02-21 10:43:01 +01:00
Oliver Drotbohm
99d2f62646 Adapt to changes in entity creation metadata APIs in Spring Data Commons. 2022-02-16 08:01:00 +01:00
Jens Schauder
21a2228204 Fixes NPE in PersistentPropertyPathExtension.equals.
Closes #1164
2022-02-15 11:49:00 +01:00
Jens Schauder
606f63b2ab Polishing.
Adding references to issues on test annotations.
Made test methods package private.

See #1164
2022-02-15 11:49:00 +01:00
Jens Schauder
351ed47d7c Polishing.
Refactored the unit tests to include a negative case and to separate the different scenarios tested.

Removed the default LockMode from the Lock annotation.
I have the feeling that most users will assume an exclusive Lock when none is specified, but also don't want to request stronger locks than required.

Original pull request #1158
See #1041
2022-02-15 11:49:00 +01:00
Diego Krupitza
11a236402b Introduced pessimistic locks for derived queries.
Methods which use the derive query functionality now can be annotated with `@Lock` to used a given `LockMode`. Right now there are two different modes `PESSIMISTIC_READ` and `PESSIMISTIC_WRITE`. Based on the dialect the right select is generated. For example for HSQLDB `Select ... FOR UPDATE`.

See #1041
Original pull request #1158
2022-02-15 11:49:00 +01:00
Jens Schauder
4066df9cf9 Polishing.
Rename "null handling" to "null precedence".
This is somewhat inconsistent with commons null handling, but more descriptive.

Minor formatting.

Original pull request #1156
See #821
2022-02-15 11:49:00 +01:00
Chirag Tailor
60a59b61c1 Null precedence is now supported if the underlying database supports it.
Original pull request #1156
Closes #821
2022-02-15 11:48:59 +01:00
Jens Schauder
73a6b3390e Replaces java.sql.Types constants with java.sql.SQLType values.
java.sql.Types constants are int values and therefore make it tedious to read and debug the code.
SQLType values are mostly enum constants which are much nicer to use.

Original pull request #1142
2022-02-15 11:46:55 +01:00
Jens Schauder
38372544f3 Polishing.
See #1046
Original pull request #1144
2022-02-15 11:40:32 +01:00
Jens Schauder
7babd7ab86 Replaces broken test with a working one.
See #1046, #498
Original pull request #1144
2022-02-15 11:40:10 +01:00
Chirag Tailor
9aa67f5e51 Support element conversion of array results.
This is achieved by passing the full availabe type information of the conversion target to the conversion service.

This broke a test which wasn't functional in the first place which becomes obvious when adding the proper assertion.

Closes #1046
Original pull request #1144
2022-02-15 11:39:52 +01:00
Jens Schauder
45b4092e8c Follow through with the split of CRUD repository and sorting repository.
See #1165
2022-02-11 11:18:20 +01:00
Mark Paluch
5a312d4b2d Prepare next development iteration.
See #1126
2022-01-14 14:43:19 +01:00
Mark Paluch
595d58b18a Release version 3.0 M1 (2022.0.0).
See #1126
2022-01-14 14:35:09 +01:00
Jens Schauder
07cef3f21a Moved JdbcValue
This avoids cyclic dependencies between mapping and conversion.

Closes #1062
See #1128
2022-01-14 09:31:13 +01:00
Jens Schauder
a5d584ec42 Remove Eclipse Non-Javadoc comments.
Closes #1120
2022-01-14 08:48:28 +01:00
Jens Schauder
4042522474 Reimplemented dependency tests using ArchUnit.
Moved RelationalAuditingCallback and JdbcArrayColumns to remove dependency cycle.

Closes #1058
Original pull request #1107
2022-01-14 08:48:28 +01:00
Jens Schauder
a75dba3d20 Moving off removed constructor of AuditHandler
See #1055
2022-01-14 08:48:28 +01:00
Jens Schauder
2646fd5bba Disabling Degraph DependencyTests.
See #1058
2022-01-14 08:48:28 +01:00
Jens Schauder
f0bc1b179f Fixed inconsistent poms.
See: #1055
2022-01-14 08:48:27 +01:00
Jens Schauder
794b031507 Prepared move of JdbcValue to mapping.
This is to avoid dependency cycles between mapping and conversion.

Closes #1128
2022-01-14 08:45:05 +01:00
Jens Schauder
09f78c4786 Add JdbcValue as a simple type.
Closes #1122
2022-01-12 11:45:36 +01:00
Jens Schauder
1acb66645d Fix missing class issue with H2 version 2.0.202
With older versions H2 returned a proprietary  instance of `TimestampWithTimeZone` from `ResultSet.getObject()`.
We used to support the conversion of that to an `OffsetDateTime`.

With the most recent versions `TimestampWithTimeZone` is no longer part of the H2 driver, and we only register the converter when we encounter older versions of H2.

Closes #1114
See https://github.com/h2database/h2database/pull/1359
2021-12-17 09:15:55 +01:00