The consistency to apply on generated view queries (Stale) and N1QL queries (ScanConsistency) can now be chosen via the configuration, through a more abstract Consistency enumeration.
It is accessed from the CouchbaseOperations interface but is used in the repository only. In xml, the consistency attribute is on the couchbase:template element (string value of the enum to be passed in).
Documentation has been amended to describe this feature.
ParametrizedQuery is now ParameterizedQuery, a few parameters have been added to the environment parsing, made use of N1QL Functions where newly available.
Replaces all references to BeanWrapper with usage of PersistentPropertyAccessor API. MappingCouchbaseEntityInformation now extends PersistentEntityInformation to get rid of obsolete code implemented by the superclass.
The @Field annotation has been removed in favor of the one from the Couchbase SDK.
Similarly, CouchbasePersistentEntity now recognize the SDK's @Id annotation. Note that if both Spring Data and Couchbase @Id are present (on two distinct fields), the one from Spring Data will be taken into account.
Detect N1QL is not available at configuration time for the repositories and at runtime for the template. This throws a UnsupportedCouchbaseFeatureException.
The ClusterInfo is captured at bootstrap and used to determine if the feature is available. The xml configuration will need the ClusterInfo-related credentials to be provided explicitly.
The documentation has been updated to reflect the changes in the new Spring Data Couchbase 2.0.
A simple list of major changes to take into account when migrating from 1.x to 2.x has been added.
README.md has also been updated.
When deriving a query, use the CouchbaseConverter to transform the parameters for fields that would be converted upon storage.
Reworked the DateConverters so that reading conversion is done from any Number (since N1QL may return longs in Double scientific notation for example).
@View can now trigger a basic query derivation. If viewName's explicitly
set, query derivation is attempted. Otherwise, no derivation is made but
instead the viewName is guessed by using the method name and removing a
"find" or "count" prefix.
Methods prefixed with "count" (and in general detected as count
projections) will trigger a reduce on the view.
The @N1QL annotation was changed to @Query, for discoverability and also
convey that this is now the preferred method.
Order is now view if @View present, N1ql inline if @Query present with
a Statement, N1ql query derivation if @Query without attribute or no
annotation.
@View can be without attribute in order to compute the view
and design document from method name.
Abstracted the N1QL-based variants in AbstractN1qlBasedQuery. This implementation doesn't recognize QueryParams or QueryPlan anymore in the method parameters so that the method signatures are not store-dependent.
Added query derivation from PartTree to N1QL query, using N1qlQueryCreator.
Unit tested the mapping between a Part.Type and the corresponding N1QL Expression.
The annotation allows to execute N1QL queries that are provided inline. For ease of use, one can use the placeholder $SELECT_ENTITY$ instead of writing the SELECT and FROM clauses.
QueryParams passed in as a method parameter will be used to enrich the Query. Other parameters on the annotated method will be used as values for positional placeholders in the statement.
The template's findByN1QL now expect enough data to reconstruct the full CouchbaseDocument (including ID and CAS), the ad hoc version of it has been renamed findByN1QLProjection.
Adaptation were made to use SDK 2.0:
- Reworked the configuration approach (more parts to be configured, like Environment, Cluster and Bucket)
- Added a new xml schema for configuration of 2.0 version
- Adapted the template
- Added N1QL support in the template (findByN1QL)
- Removed the cache package
- Adapted the repository
- Better separated Unit Tests from Integration Tests
All integration and unit tests pass, except one (SimpleCouchbaseRepositoryTests.shouldFindCustom).
Customisation of a ViewQuery will be addressed in another ticket.
The repositoryBaseClass attribute is needed for spring-data-commons 1.4
support. Without it, an assertion fails while spring is trying to
configure the repositories enabled by this annotation,.
Updated copyright years. Fall back to locally available Spring Data Commons reference docs as the remote variant doesn't seem to work currently. Included reference to the return type listing appendix from Spring Data Commons.