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.
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.
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.
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.
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.
DeleteWithVersion doesn't require an entity anymore.
Added the `@author` and `@since` tags where they were missing.
Formatting.
Added documentation.
Original pull request: #166.
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.
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.
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.
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.
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.
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.
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.