@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,.
This changeset adds validation support for entities, and since this depends
on events, the event functionality has been added as well. Now also generic
event listeners can be attached.
This changeset adds aut of the box support for date and calendar objects.
They get converted to simple longs (unix timestamps) and back, since couchbase
server views have good support for those through the dateToArray() function.
A custom converter takes precedence though to customize these conversions.
@Version support is built on top of CAS values in couchbase. It does
not store an actual version number in the document, but rather reuses
cas values transparently to handle optimistic locking.
Also, write result checking has been added to the template for
better control what happens if a write fails. Defaults to NONE,
but can be sett to LOG or EXCEPTION.
If the whole system is constructed through the AbstractCouchbaseConfiguration or
the custom <couchbase> xml config, the logger is specified automatically.
Please note that this also changes the java config a little bit, but it should
also make it easier to construct it.
Enums, even although they are a simple type, must not use writeSimpleObject
since there is no "handler" in writeSimpleObject for Enums. Instead, we just
drop back to using the built-in ObjectMapper for handling enums.
-=david=-
An initial first attempt at allowing for basic View customization using the
@View annotation.
For now, it does not support "dynamic" finders, such as findByUsername, but
I'm sure it will come shortly aftewards.
Also added in hamcrest library to gradually transistion deprecated JUnit
methods to a better assertion library :-)
-=david=-