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=-
This changeset is a complete refactor of the mapping layer to make
sure that _class complex type mapping works. It also decouples
the actual JSON mapping and abstracts it into a CouchbaseDocument
mapping. This ensures forward compatibility by potentially swapping
out JSON to a different format.
This changeset implements basic view support for both the CRUDRepository
and the underlying template imeplementation. Note that customization is
currently missing, we'll provide a @View annotation that lets you
customize behavior.