Commit Graph

211 Commits

Author SHA1 Message Date
mikereiche
05fb9eadbe DATACOUCH-585 - Support ScanConsistency for count() queries. 2020-07-17 11:53:45 -07:00
mikereiche
e2444403a7 DATACOUCH-580 - Do not automatically insert n1ql.filter predicate in string query.
Since it is difficult to determine where the n1ql.filter (which typically
filters on _class), and also because it is not mandator, including
the n1ql.filter in the @query is left up to the author of the query.
Example:
@query("#{#n1ql.selectEntity} where #{#n1ql.filter} and lastname = $1")
2020-07-15 11:13:50 -07:00
mikereiche
d2456bb166 DATACOUCH-533 - Promote id field if no annotation id.
Promote id field if no annotation id.
Note that there is no longer any Couchbase @Id annotation - only
the Spring @id annotation.
2020-07-02 10:36:31 -07:00
mikereiche
ecaf58db75 DATACOUCH-532 - Use parameters in queries instead of literals.
This will allow query plans to be reused for different parameters.
2020-06-25 19:30:21 -07:00
mikereiche
c7f41f57ed DATACOUCH-574 - Support countBy...() query method calls in repository. 2020-06-24 16:00:26 -07:00
mikereiche
cd595995ed DATACOUCH-573 - use same name for count in query 2020-06-23 12:40:01 -07:00
mikereiche
e1d39fdb6f DATACOUCH-571 fix delimiters in generated id
Also clean up test domain/Config.java
2020-06-22 11:01:17 -07:00
mikereiche
69f1ff5791 DATACOUCH-546 - set generated id on entity returned to caller 2020-06-19 14:56:37 -07:00
Andrea Torlaschi
c7f12a2237 DATACOUCH-560 - Serialization of CouchbaseDocument and CouchbaseList.
Add support for saving document with lists and composed objects.
Convert CouchbaseDocument/CouchbaseList to Map/List before saving.
2020-06-10 12:27:15 -07:00
mikereiche
fbf9b3eb29 DATACOUCH-545 - return null if not found instead of throwing an exception 2020-06-09 15:43:33 -07:00
mikereiche
95c69ea8cc DATACOUCH-525 - support custom type field name and custome type field value
MOTIVATION
customers would like to specify a type field other than _class, and
would like to specify a type field value other than the class name
of the domain object

CHANGES
Follow the instructions at
https://stackoverflow.com/questions/38847605/how-to-use-spring-data-with-couchbase-without-class-attribute
in the test domain, supply a CustomMappingCouchbaseConvert class that leverates a
TypeBasedCouchbaseTypeMapper, which in turn uses a TypeAwareTypeInformationMapper.
The typeKey used is "t". The TypeAwareTypeInformationMapper uses the DocumentType annotation
as the value for the type map entry. The domain Person object has @DocumentType("p"), which
will result in type mapping of "t" : "p" for Person objects.

In addition, when a query is composed, the typeKey and typeValue are taken from the converter.
2020-06-05 10:43:39 -07:00
mikereiche
dafff211a4 DATACOUCH-542 - support @Field to supply a different name for a field 2020-06-04 09:00:42 -07:00
mikereiche
749c0a84e8 DATACOUCH - 534 Add support for Query annotation 2020-05-28 09:05:00 -07:00
Michael Nitschinger
33fdffab2f DATACOUCH-539 - Deprecate annotations before GA
This changeset also brings back deleted annotations so that they
do not cause build issues in other components.
2020-05-11 15:05:53 +02:00
Michael Nitschinger
799fec702c DATACOUCH-538 - Add scan consistency to analytics query template 2020-05-08 17:01:21 +02:00
Michael Nitschinger
405df74fa0 DATACOUCH-519 - Docs and small changes for transaction support. 2020-05-08 15:34:17 +02:00
Michael Nitschinger
7773a19e42 DATACOUCH-531 - Add license headers to missing files. 2020-05-06 15:10:22 +02:00
Michael Nitschinger
b47fc007b5 DATACOUCH-531 - Initial javadoc polish for GA 2020-05-06 14:54:34 +02:00
Michael Nitschinger
e262a05184 DATACOUCH-519 - Apply formatting for changes 2020-05-06 10:35:04 +02:00
mikereiche
e8e13ffebc DATACOUCH-519 - Reinstate template auditing
This reinstates the auditing that was present before the major
refactoring. Additional testing for createdBy, createdDate,
lastModifiedBy, lastModifiedDate has been added as well.
2020-05-06 10:32:11 +02:00
Michael Nitschinger
af960817e9 DATACOUCH-504 - Apply eclipse formatting rules. 2020-04-19 07:21:35 +02:00
Michael Nitschinger
b1ed8941bb DATACOUCH-504 - Make sure reactive repositories can be used
This changeset fixes an issue where while blocking repositories would
work properly, the reactive repositories won't. This has been an
oversight in the transition before RC1.
2020-04-19 07:14:59 +02:00
Michael Reiche
0c0dc21f8e DATACOUCH-515 implement additional operators in N1qlQueryCreator and QueryCriteria (#213)
Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-04-07 16:45:53 +02:00
Michael Nitschinger
ad56d48926 DATACOUCH-504 - Optimize shutdown of cluster
Only shut it down on the factory if internally initialized and
make sure we properly close it on the config.
2020-03-17 15:05:44 +01:00
Michael Nitschinger
f950e4648a DATACOUCH-504 - Reintroduce query index generation
This changeset reintroduces automatic n1ql index generation but through
new annotations: QueryIndexed and CompositeQueryIndex (as well as
CompositeQueryIndexes to supply more than one). They are translated
into create index statements and executed at startup if configured
in the config.

Note that automatic index management is disabled by default but can
be overidden with a simple flag on the config override. More features
to come later.
2020-03-17 15:05:41 +01:00
Michael Nitschinger
3bd9635df3 DATACOUCH-509 - remove the configurer again
Boot figured out a better way to handle it, so we can get rid of
it again.
2020-03-17 15:05:34 +01:00
Michael Nitschinger
e100042850 DATACOUCH-504 - Make sure Reactive* repository take the reactive operations. 2020-03-17 15:05:30 +01:00
Michael Nitschinger
573e389f22 DATACOUCH-509 - Align environment naming in configurer 2020-03-17 15:05:24 +01:00
Michael Nitschinger
e918fa8793 DATACOUCH-509 - couchbaseClientFactory needs to take cluster from configurer 2020-03-17 15:05:20 +01:00
Michael Nitschinger
1ee0045f0e DATACOUCH-509 - Expose only SDK related infos on configurer
Since the client factory is a spring data concept, it cannot be
exposed on the configurer. Only expose the cluster and the environment
on it.

This also modifies the config to populate the right beans from the
configurer methods as well.
2020-03-17 15:05:14 +01:00
Michael Nitschinger
cf67ab44cc DATACOUCH-504 - Make couchbase cache config available.
Spring boot needs to be able to access the cache config on the
CouchbaseCache instance, so make it available.
2020-03-17 15:05:09 +01:00
Michael Nitschinger
daf479b345 DATACOUCH-509 - Restore CouchbaseConfigurer
Since boot needs it for easy mocking/testing, restoring the
configurer (but with the new corresponding beans and only
the subset that is currently available).
2020-03-17 15:05:05 +01:00
Michael Nitschinger
4abad35639 DATACOUCH-504 - More enhancements for spring boot 2020-03-17 15:05:01 +01:00
David Kelly
c9a19c925e DATACOUCH-504 - Migrate to Couchbase SDK 3 2020-03-17 15:04:37 +01:00
Mark Paluch
e944081b94 DATACOUCH-498 - Update copyright years to 2020. 2020-01-07 08:43:29 +01:00
David Kelly
f69d51586d DATACOUCH-484 - Thread safety issue using findBy.
Support for positional parameters necessitated caching them, however
that was not done in a threadsafe fashion.  ThreadLocal storage is
sufficient to take care of the issue.  Added test for it while at it.
2019-11-13 08:37:17 -07:00
David Kelly
98a4999f37 DATACOUCH-383 - RxJavaCouchbaseTemplate should return generated id when saving.
Seems we fixed this for the non-Rx version, but not the RxJava version.  Followed
same basic strategy which was used for version, added a simple test.
2019-08-01 09:58:32 -07:00
Mark Paluch
1de7acd1eb DATACOUCH-465 - Adapt to changed API in Commons. 2019-07-26 09:25:40 +02:00
David Kelly
4341edf941 DATACOUCH-462 - ReactiveCouchbaseRepository count() will raise exception when bucket is empty.
Small cleanup in the deleteAll test (which actually tests this as well), while
we are there.

Also, removed an unused import
2019-06-28 10:21:41 -06:00
David Kelly
64a91f1eb6 DATACOUCH-356 Fix cast issue in deleteAll (#201)
Plus a test.  I didn't notice that Douglas Six did basically the
same thing in another PR (this was a re-do of an earlier PR which
didn't quite do what we'd like).  So since I already had it done
and had a test, I closed that PR (#163) and added him to the author
list.

Also - repository.count() raises a NoSuchElementException after you
delete all the documents.  That seems like a bug, but we will deal
with that separately.
2019-06-26 16:37:11 -06:00
Johannes Jasper
55235b2bc2 DATACOUCH-206 - Provides a way to set distinct consistency on repository methods.
* add @WithConsistency annotation
* evaluate it and set consistency in AbstractN1qlBasedQuery
* evaluate it and set consistency in ReactiveAbstractN1qlBasedQuery
* add documentation on @WithConsistency

Original pull request: #198.
2019-06-26 21:48:01 +02:00
Spring Operator
2f4500e9c7 DATACOUCH-439 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 219 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).

Original Pull Request: #195
2019-03-22 11:19:57 +01:00
Subhashni Balakrishnan
e1e4385896 DATACOUCH-438 - Move off deprecations in Spring Data Commons.
Remove stray import IsNewStrategyFactory. This has been removed from commons and causing build failure.

Related ticket: DATACMNS-1496.
2019-03-13 19:01:26 +01:00
ctayeb
97fc4a0471 DATACOUCH-432 - Fix ANSI Joins OneToOne relationships
Couchbase template could get only the component type information which
works for collection properties but when the join is one-to-one for a
single generic type it would fail. The fix is use to the actual type if
the property is not a collection.

Original PR: #177.
2019-02-22 12:14:04 -08:00
Subhashni Balakrishnan
2f0e255fbb DATACOUCH-415 - Improve performance by re-using the same set instance
Reuse the same instance of the set instead of recreating each time

Original PR: #176
2019-02-12 16:29:06 -08:00
Subhashni Balakrishnan
580a50b40f DATACOUCH-388 Add support for ANSI-JOIN across entities
Motivation
----------
To support ANSI JOIN across associated entities

Changes
-------
N1qlJoin annotation on an associated entity field is discovered by the
couchbaseTemplate, which uses N1qlJoinResolver to build and resolve the
query. The query can be resolved eagerly or lazily based on the fetch
type configuration. The retrieved results are then mapped to the
associated entity. In the lazy resolver, a proxy is set on the property
which resolves on the first access.

Results
-------
Verified by unit and integration tests. ANSI join is now possible across
entities.

Original PR: #174
2019-02-12 09:56:58 -08:00
Mark Paluch
f4116f6de6 DATACOUCH-425 - Update copyright years to 2019. 2019-01-02 12:31:10 +01:00
Subhashni Balakrishnan
c4491dc8b4 DATACOUCH-413 Use parameterized queries for Query derivation
Changes
-------
- N1ql query creators implement an interface which provides the place
holder values.
- The query creator uses a position index counter to inject place holders in
the statement created and caches the place holder values in an array.
- Repository query constructor passes the generated query statement
and place holder values to query through the SDK.
- Cleanup N1ql integration tests for count validation and also add
couple of more tests

Results
-------
The testing for changes are already covered under the modified existing tests
in N1qlQueryCreator and Repository.
2018-11-26 11:23:14 -08:00
Subhashni Balakrishnan
9840acd2c6 DATACOUCH-384 - Apply converters to string based query parameters
Apply the converters registered to serialize the positional and named
parameters to match the database representation

Original Pull Request: #172.
2018-11-07 14:39:11 -08:00
Subhashni Balakrishnan
5af4dae334 DATACOUCH-401 Fix incorrect return type for reactive string based N1ql count query
Motivation
----------
Reactive string based N1QL count query incorrectly returns the map after
the single result projection.

Changes
-------
Map the observable returning from the N1ql query result deserialized to
a map by converting to the correct return type using the conversion
service. Verified by integration tests.
2018-09-20 23:06:36 -07:00