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.
This commit is contained in:
ctayeb
2019-02-22 13:00:41 +01:00
committed by Subhashni Balakrishnan
parent 5af2262029
commit 97fc4a0471
7 changed files with 121 additions and 22 deletions

View File

@@ -92,6 +92,7 @@ import static org.springframework.data.couchbase.core.support.TemplateUtils.SELE
* @author Simon Baslé
* @author Young-Gu Chae
* @author Mark Paluch
* @author Tayeb Chlyah
*/
public class CouchbaseTemplate implements CouchbaseOperations, ApplicationEventPublisherAware {
@@ -721,7 +722,7 @@ public class CouchbaseTemplate implements CouchbaseOperations, ApplicationEventP
persistentEntity.doWithProperties((PropertyHandler<CouchbasePersistentProperty>) prop -> {
if (prop.isAnnotationPresent(N1qlJoin.class)) {
N1qlJoin definition = prop.findAnnotation(N1qlJoin.class);
TypeInformation type = prop.getTypeInformation().getComponentType();
TypeInformation type = prop.getTypeInformation().getActualType();
Class clazz = type.getType();
N1qlJoinResolver.N1qlJoinResolverParameters parameters = new N1qlJoinResolver.N1qlJoinResolverParameters(definition, id, persistentEntity.getTypeInformation(), type);
if (N1qlJoinResolver.isLazyJoin(definition)) {